diff --git a/framer/LayerDraggable.coffee b/framer/LayerDraggable.coffee index 706ba7ddc..f0919e2cd 100644 --- a/framer/LayerDraggable.coffee +++ b/framer/LayerDraggable.coffee @@ -370,11 +370,14 @@ class exports.LayerDraggable extends BaseClass @_directionLockEnabledX = Math.abs(correctedDelta.y) > @directionLockThreshold.y @_directionLockEnabledY = Math.abs(correctedDelta.x) > @directionLockThreshold.x - xSlightlyPreferred = Math.abs(correctedDelta.y) > @directionLockThreshold.y / 2 - ySlightlyPreferred = Math.abs(correctedDelta.x) > @directionLockThreshold.x / 2 + # TODO: This wasn't working as advertised. We shouls have a way to scroll diagonally + # if we were sort of moving into both directions equally. - # Allow locking in both directions at the same time - @_directionLockEnabledX = @_directionLockEnabledY = true if (xSlightlyPreferred and ySlightlyPreferred) + # xSlightlyPreferred = Math.abs(correctedDelta.y) > @directionLockThreshold.y / 2 + # ySlightlyPreferred = Math.abs(correctedDelta.x) > @directionLockThreshold.x / 2 + + # # Allow locking in both directions at the same time + # @_directionLockEnabledX = @_directionLockEnabledY = true if (xSlightlyPreferred and ySlightlyPreferred) if @_directionLockEnabledX or @_directionLockEnabledY @emit Events.DirectionLockDidStart, @@ -427,8 +430,8 @@ class exports.LayerDraggable extends BaseClass _onSimulationStep: (axis, state) => - return if axis is "x" and (@_directionLockEnabledX or @horizontal is false) - return if axis is "y" and (@_directionLockEnabledY or @vertical is false) + return if axis is "x" and @horizontal is false + return if axis is "y" and @vertical is false # The simulation state has x as value, it can look confusing here # as we're working with x and y. diff --git a/test/studio/PageComponentLockDirection.framer/app.coffee b/test/studio/PageComponentLockDirection.framer/app.coffee index 50485a5cb..9e7ef5f8f 100644 --- a/test/studio/PageComponentLockDirection.framer/app.coffee +++ b/test/studio/PageComponentLockDirection.framer/app.coffee @@ -8,7 +8,7 @@ page = new PageComponent page.scrollVertical = false page.directionLock = true -for index in [0..8] +for index in [0..2] pageContent = new ScrollComponent width: page.width @@ -20,6 +20,9 @@ for index in [0..8] pageContent.scrollHorizontal = false pageContent.directionLock = true + page.on Events.DirectionLockDidStart, (direction) -> + print "pageContent.DirectionLockDidStart", direction + rows = 10 gutter = 2 height = 200 @@ -39,3 +42,6 @@ for index in [0..8] "text-align": "center" "line-height": "#{cellLayer.height}px" + +page.on Events.DirectionLockDidStart, (direction) -> + print "page.DirectionLockDidStart", direction \ No newline at end of file