简体   繁体   中英

Fabric.js - Moving an object under the selected object

I have 2 objects (images) in my canvas.

fc.item(0) is a smaller image in the middle of the canvas. fc.item(1) is a large image, "frame". The user can't move it. When the user's trying to move the fc.item(1) , I wanna move the fc.item(0) , as if the user's moved on the fc.item(1) .

Any idea, how can I do this? I tried to use the fc.item(0).fire("object:moving") , but this didn't work well.

If you want to make top object unselectable just set its "selectable" to false .

fc.item(1).selectable = false;

If you also want to propagate events to the bottom object (essentially "ignoring" top one), set top one's "evented" property to false .

fc.item(1).evented = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM