Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Cleanup for stopping animations on draggable
- Loading branch information
Showing
with
22 additions
and
6 deletions.
-
+3
−1
framer/LayerDraggable.coffee
-
+19
−5
test/tests/LayerTest.coffee
|
@@ -132,8 +132,10 @@ class exports.LayerDraggable extends BaseClass |
|
|
# so we can use it to detect a click versus a drag. |
|
|
@_isMoving = @isAnimating |
|
|
|
|
|
# Stop any animations influencing the position, but no others. |
|
|
for animation in @layer.animations() |
|
|
if animation.options.properties.hasOwnProperty('x') or animation.options.properties.hasOwnProperty('y') |
|
|
properties = animation.options.properties |
|
|
if properties.hasOwnProperty("x") or properties.hasOwnProperty("y") |
|
|
animation.stop() |
|
|
|
|
|
@_stopSimulation() |
|
|
|
@@ -1026,10 +1026,24 @@ describe "Layer", -> |
|
|
copy.width.should.equal 100 |
|
|
copy.height.should.equal 100 |
|
|
|
|
|
# it "copied layer should copy styles", -> |
|
|
|
|
|
# layer = new Layer |
|
|
# layer.style.backgroundColor = "yellow" |
|
|
describe "Draggable", -> |
|
|
|
|
|
it "should stop x and y animations on drag start", -> |
|
|
|
|
|
layer = new Layer |
|
|
layer.draggable.enabled = true |
|
|
|
|
|
a1 = layer.animate properties: {x:100} |
|
|
a2 = layer.animate properties: {y:100} |
|
|
a3 = layer.animate properties: {blur:1} |
|
|
|
|
|
a1.isAnimating.should.equal true |
|
|
a2.isAnimating.should.equal true |
|
|
a3.isAnimating.should.equal true |
|
|
|
|
|
layer.draggable.touchStart(document.createEvent("MouseEvent")) |
|
|
|
|
|
# layer2 = layer.copy() |
|
|
# layer2.style.backgroundColor.should.equal "yellow" |
|
|
a1.isAnimating.should.equal false |
|
|
a2.isAnimating.should.equal false |
|
|
a3.isAnimating.should.equal true |
This comment has been minimized.
@fverloop check out:
This comment has been minimized.
Much better, tests seem pretty powerful too👍