Skip to content

Commit

Permalink
Fix scale drag bug
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Apr 2, 2015
1 parent 3098d23 commit a5e1a1a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions framer/LayerDraggable.coffee
Expand Up @@ -151,9 +151,9 @@ class exports.LayerDraggable extends BaseClass
y: touchEvent.clientY - @_correctedLayerStartPoint.y y: touchEvent.clientY - @_correctedLayerStartPoint.y


# Store the current layer scale so we can correct movement for it # Store the current layer scale so we can correct movement for it
@_screenScale = @_canvasFrame =
x: @layer.screenScaleX() x: @layer.canvasScaleX()
y: @layer.screenScaleY() y: @layer.canvasScaleY()


document.addEventListener(Events.TouchMove, @_touchMove) document.addEventListener(Events.TouchMove, @_touchMove)
document.addEventListener(Events.TouchEnd, @_touchEnd) document.addEventListener(Events.TouchEnd, @_touchEnd)
Expand All @@ -179,8 +179,8 @@ class exports.LayerDraggable extends BaseClass
y: touchEvent.clientY - @_correctedLayerStartPoint.y - @_layerCursorOffset.y y: touchEvent.clientY - @_correctedLayerStartPoint.y - @_layerCursorOffset.y


# Scale the offset with the screen scale for the current layer # Scale the offset with the screen scale for the current layer
offset.x = offset.x * @speedX * (1 / @_screenScale.x) * @layer.scaleX * @layer.scale offset.x = offset.x * @speedX * (1 / @_canvasFrame.x) * @layer.scaleX * @layer.scale
offset.y = offset.y * @speedY * (1 / @_screenScale.y) * @layer.scaleY * @layer.scale offset.y = offset.y * @speedY * (1 / @_canvasFrame.y) * @layer.scaleY * @layer.scale


# See if horizontal/vertical was set and set the offset # See if horizontal/vertical was set and set the offset
point = @layer.point point = @layer.point
Expand Down Expand Up @@ -482,8 +482,8 @@ class exports.LayerDraggable extends BaseClass


velocity = @velocity velocity = @velocity


velocityX = velocity.x * @momentumVelocityMultiplier * @speedX * (1 / @_screenScale.x) * @layer.scaleX * @layer.scale velocityX = velocity.x * @momentumVelocityMultiplier * @speedX * (1 / @_canvasFrame.x) * @layer.scaleX * @layer.scale
velocityY = velocity.y * @momentumVelocityMultiplier * @speedY * (1 / @_screenScale.y) * @layer.scaleY * @layer.scale velocityY = velocity.y * @momentumVelocityMultiplier * @speedY * (1 / @_canvasFrame.y) * @layer.scaleY * @layer.scale


@_setupSimulation() @_setupSimulation()
@_isAnimating = true @_isAnimating = true
Expand Down

0 comments on commit a5e1a1a

Please sign in to comment.