KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Drag and Drop a shape filled with image

Open Wazabii opened this issue 14 years ago • 10 comments

I tried creating jigsaw puzzle using kineticjs. Puzzle pieces is created by using Kinetic.Shape filled with image.

When i apply dragging to the shape, memory leaks (not sure where) occur and crashes the whole browser (Only happened in Mozilla Firefox).

Works perfectly in Chrome and had some frame loss on IE and Safari.

I've tried to reduce the puzzle pieces, but the problem is the same although it can survive longer before crashes.

Wazabii avatar Aug 29 '12 11:08 Wazabii

additional info.. i found out that not only drag and drop causes issue, but also with transition. So basically if we try to move the shapes that contains image, the movement will cause memory leaks in firefox AND iOS.

Cheers

Wazabii avatar Sep 24 '12 04:09 Wazabii

have you tried moving the image to its own layer when dragging and dropping? This greatly improves performance. Here's an example:

http://www.html5canvastutorials.com/labs/html5-canvas-kineticjs-drag-and-drop-stress-test-with-1000-shapes/

ericdrowell avatar Oct 06 '12 02:10 ericdrowell

but to your point, I'll look into the FF issue as soon as I get a chance.

ericdrowell avatar Oct 06 '12 02:10 ericdrowell

Ah yes.. i tried using that and it works great in improving the drag and drop. But the firefox crashing issue is still there. If I try to drag more than one object at the same time, FF will crash (I'm currently using FF 15.0.1).

I believe it has something to do with the fill property.

Thanks.

Wazabii avatar Oct 06 '12 07:10 Wazabii

yeah there is some bug with FF but i dont know where, because of my map

http://blackscorp.github.com/tiled2crafty/kinetic/

draw process takes 22ms on FF, on Chrome/IE/Opera/Safari 0-1 ms basicly i just copy offscreen layer into the screen wonder what is going on there

BlackScorp avatar Oct 06 '12 11:10 BlackScorp

Hi @ericdrowell . Just wondering whether this issue will be patched in the next version of KineticJS?

THanks.

Wazabii avatar Nov 02 '12 13:11 Wazabii

v4.0.5 is already looking pretty heavy, so this issue will probably be addressed with a later version (mostly because it seems to be a FF bug)

ericdrowell avatar Nov 02 '12 15:11 ericdrowell

can someone check this on other browser please? http://jsperf.com/simple-draw wish to look if its a kinetic or ff problem

BlackScorp avatar Nov 02 '12 16:11 BlackScorp

I can confirm FF-specific issues when using image fills. FF's memory usage absolutely explodes when rapidly redrawing layers containing multiple image fills. Too much redrawing (e.g., dragging a layer for 5+ seconds) inevitably leads to a crash.

Chrome handles the same with no problem.

akbr avatar Nov 02 '12 16:11 akbr

Although there have been a lot of performance improvements made with drag and drop, this issue is ultimately dependent on the FF Canvas API implementation. Dragging and dropping a shape filled with a pattern actually performed pretty well for me in FF.

ericdrowell avatar Jan 08 '13 04:01 ericdrowell