[英]Fabric.js - Moving an object under the selected object
I have 2 objects (images) in my canvas. 我的画布中有2个对象(图像)。
fc.item(0)
is a smaller image in the middle of the canvas. fc.item(0)
是画布中间的较小图像。 fc.item(1)
is a large image, "frame". fc.item(1)
是一个大图像,“帧”。 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)
. 当用户试图移动
fc.item(1)
,我想移动fc.item(0)
,就像用户移动了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. 我试图使用
fc.item(0).fire("object:moving")
,但这并没有奏效。
If you want to make top object unselectable just set its "selectable" to false
. 如果要使顶级对象不可选,只需将其“可选”设置为
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
. 如果你也想传播事件的底部对象(基本上是“忽略”顶一个),机顶盒一个人的“事件触发”属性设置为
false
。
fc.item(1).evented = false;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.