有没有办法让“移动”监听器在对象作为选择的一部分移动时触发?
rect2 = new fabric.Rect(
left: 150
top: 10
fill: "green"
width: 20
height: 20
)
# Red&Green Rect: When moving "green", event fires, when moving both, it does not
rect2.on "moving", ->
#Only fires when the object is moved on it´s own :(
jsFiddle -> http://jsfiddle.net/thomasf1/mJjH6/2/
最佳答案
您可以通过 event.target._objects
在 Canvas object:moving
事件中访问所有组对象。请注意,fabric 在移动组时不会更改子坐标,因此您应该将子左坐标添加到组左坐标以获得真正的左位置。
看看我的jsFiddle例子
关于javascript - Fabric .js : Is there a way to make the "move" listener fire when moved as part of a selection?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24306659/