Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix constrained draggable
  • Loading branch information
koenbok committed Jan 28, 2016
1 parent 719b8d5 commit 4581bf2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions framer/LayerDraggable.coffee
Expand Up @@ -186,6 +186,8 @@ class exports.LayerDraggable extends BaseClass
point.x = @_point.x + (event.delta.x * scaleX) if @horizontal point.x = @_point.x + (event.delta.x * scaleX) if @horizontal
point.y = @_point.y + (event.delta.y * scaleY) if @vertical point.y = @_point.y + (event.delta.y * scaleY) if @vertical


@_point = _.clone(point)

# Constraints and overdrag # Constraints and overdrag
point = @_constrainPosition(point, @_constraints, @overdragScale) if @_constraints point = @_constrainPosition(point, @_constraints, @overdragScale) if @_constraints


Expand All @@ -207,8 +209,7 @@ class exports.LayerDraggable extends BaseClass
if @isDragging if @isDragging
@emit(Events.DragWillMove, event) @emit(Events.DragWillMove, event)


@_point = _.clone(point) # Align every drag to pixels

if @pixelAlign if @pixelAlign
point.x = parseInt(point.x) if @horizontal point.x = parseInt(point.x) if @horizontal
point.y = parseInt(point.y) if @vertical point.y = parseInt(point.y) if @vertical
Expand Down

0 comments on commit 4581bf2

Please sign in to comment.