当对象作为选择的一部分移动时,是否有办法使“移动”侦听器触发?
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/
解决方法:
您可以通过canvas object:moving事件中的event.target._objects访问所有组对象.请注意,织物在移动组时不会更改子坐标,因此应将子左坐标添加到组左坐标以获取实际的左位置.
看我的jsFiddle示例