Skip to content

Commit

Permalink
Making behaviour for ignoring clicks while dragging better
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Jan 28, 2016
1 parent 6c1eee0 commit b2b197d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions framer/Layer.coffee
Expand Up @@ -73,7 +73,6 @@ class exports.Layer extends BaseClass


# Private setting for canceling of click event if wrapped in moved draggable # Private setting for canceling of click event if wrapped in moved draggable
@_cancelClickEventInDragSession = true @_cancelClickEventInDragSession = true
@_cancelClickEventInDragSessionTolerance = 4


# We have to create the element before we set the defaults # We have to create the element before we set the defaults
@_createElement() @_createElement()
Expand Down Expand Up @@ -943,11 +942,7 @@ class exports.Layer extends BaseClass


if @_cancelClickEventInDragSession if @_cancelClickEventInDragSession
if eventName is Events.Click if eventName is Events.Click
parentDraggableLayer = @_parentDraggableLayer() return if @_parentDraggableLayer()?.draggable.isMoving
if parentDraggableLayer
offset = parentDraggableLayer.draggable.offset
return if Math.abs(0 - offset.x) > @_cancelClickEventInDragSessionTolerance
return if Math.abs(0 - offset.y) > @_cancelClickEventInDragSessionTolerance


# Always scope the event this to the layer and pass the layer as # Always scope the event this to the layer and pass the layer as
# last argument for every event. # last argument for every event.
Expand Down

0 comments on commit b2b197d

Please sign in to comment.