Reputation: 297
my question is, fabric.js makes active object on top of others when dragging.
I know a property can do this, can't remind.
Thanks.
Upvotes: 1
Views: 3187
Reputation: 11
I know it's been a long time since you asked this but I want to answer it if anyone would stuck for that.
This behavior is default in fabric js right know but if you want to change it just set preserveObjectStacking
to false
when initializing the canvas. See more in documentation.
Upvotes: 0
Reputation: 3766
You can do it like this:
canvas.add(red, blue); // add youre objects..
function myDrag(e) { // funciton on drag (moving)
e.target.bringToFront();
}
canvas.on({
'object:moving': myDrag,
});
Want to add more events? Use the Event inspector @ fabricjs
I made a working Fiddle. Hopes it helps...
Upvotes: 1