Permalink
Browse files

Fix scale drag bug

  • Loading branch information...
koenbok committed Apr 2, 2015
1 parent 3098d23 commit a5e1a1acc2082c67c7aa01f4ad836a203f220285
Showing with 7 additions and 7 deletions.
  1. +7 −7 framer/LayerDraggable.coffee
@@ -151,9 +151,9 @@ class exports.LayerDraggable extends BaseClass
y: touchEvent.clientY - @_correctedLayerStartPoint.y
# Store the current layer scale so we can correct movement for it
@_screenScale =
x: @layer.screenScaleX()
y: @layer.screenScaleY()
@_canvasFrame =
x: @layer.canvasScaleX()
y: @layer.canvasScaleY()
document.addEventListener(Events.TouchMove, @_touchMove)
document.addEventListener(Events.TouchEnd, @_touchEnd)
@@ -179,8 +179,8 @@ class exports.LayerDraggable extends BaseClass
y: touchEvent.clientY - @_correctedLayerStartPoint.y - @_layerCursorOffset.y
# Scale the offset with the screen scale for the current layer
offset.x = offset.x * @speedX * (1 / @_screenScale.x) * @layer.scaleX * @layer.scale
offset.y = offset.y * @speedY * (1 / @_screenScale.y) * @layer.scaleY * @layer.scale
offset.x = offset.x * @speedX * (1 / @_canvasFrame.x) * @layer.scaleX * @layer.scale
offset.y = offset.y * @speedY * (1 / @_canvasFrame.y) * @layer.scaleY * @layer.scale
# See if horizontal/vertical was set and set the offset
point = @layer.point
@@ -482,8 +482,8 @@ class exports.LayerDraggable extends BaseClass
velocity = @velocity
velocityX = velocity.x * @momentumVelocityMultiplier * @speedX * (1 / @_screenScale.x) * @layer.scaleX * @layer.scale
velocityY = velocity.y * @momentumVelocityMultiplier * @speedY * (1 / @_screenScale.y) * @layer.scaleY * @layer.scale
velocityX = velocity.x * @momentumVelocityMultiplier * @speedX * (1 / @_canvasFrame.x) * @layer.scaleX * @layer.scale
velocityY = velocity.y * @momentumVelocityMultiplier * @speedY * (1 / @_canvasFrame.y) * @layer.scaleY * @layer.scale
@_setupSimulation()
@_isAnimating = true

0 comments on commit a5e1a1a

Please sign in to comment.