Closed PowellT closed 9 years ago
Typically, the order is dictated by the order in which you create the layers. If one of those happens to be an image, use addLayer()
instead of normal drawing methods (such as drawImage()
with layer: true
).
The reason for this is because those drawing methods not only add the layer to the jCanvas layers array, but draws it instantly too (and image drawing is asynchronous in jCanvas—that's just the way it works). However, if you add your layers first with addLayer()
and then call drawLayers()
afterwards, then jCanvas can automatically defer drawing of successive layers until the image layer has been loaded and drawn.
If you need to move a layer at any point, use the moveLayer()
method and call drawLayers()
afterwards to see the change.
Caleb
Makes sense. Thank you for the quick reply and for making such a great plugin!!
If I have an image, a rectangle and a some text and I need to order them (by z) image z=0, rectangle z=1, text z=2 How would I do that with jcanvas?