layer.draggable.updatePosition(point)
Function to override the final value before setting it. Allows you to add your own behaviour to a draggable. This allows you to create draggable layers that snap between certain distances.
译:函数来设置前覆盖的最终值。允许您自己的行为添加到拖动。这允许您创建某些距离之间单元可拖动层。
Arguments(参数)
point — An object with x and y properties.
译:点 - 与x和y属性的对象。
layerA = new Layer
layerA.draggable.enabled = true
# Round numbers to a set amount
round = (number, nearest) ->
Math.round(number / nearest) * nearest
# Drag in increments of 20px
layerA.draggable.updatePosition = (point) ->
point.x = round(point.x, 20)
point.y = round(point.y, 20)
return point