From a33eff73f0d46b326d6fe59a7072f31624527c23 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 30 Jul 2014 17:26:45 +0300 Subject: [PATCH] replace CSS transitions in pan animations with frames --- build/deps.js | 8 +------- spec/suites/dom/PosAnimationSpec.js | 27 --------------------------- src/dom/PosAnimation.Timer.js | 5 ++--- 3 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 spec/suites/dom/PosAnimationSpec.js diff --git a/build/deps.js b/build/deps.js index a32c9213..b38ea483 100644 --- a/build/deps.js +++ b/build/deps.js @@ -227,19 +227,13 @@ var deps = { AnimationPan: { src: [ 'dom/DomEvent.js', - 'dom/PosAnimation.js', + 'dom/PosAnimation.Timer.js', 'map/anim/Map.PanAnimation.js' ], heading: 'Animation', desc: 'Core panning animation support.' }, - AnimationTimer: { - src: ['dom/PosAnimation.Timer.js'], - deps: ['AnimationPan'], - desc: 'Timer-based pan animation fallback for browsers that don\'t support CSS3 transitions.' - }, - AnimationZoom: { src: [ 'map/anim/Map.ZoomAnimation.js', diff --git a/spec/suites/dom/PosAnimationSpec.js b/spec/suites/dom/PosAnimationSpec.js deleted file mode 100644 index 9b4ebfeb..00000000 --- a/spec/suites/dom/PosAnimationSpec.js +++ /dev/null @@ -1,27 +0,0 @@ -describe('PosAnimation', function () { - var el; - - beforeEach(function () { - el = document.createElement('div'); - this.subject = new L.PosAnimation(); - this.subject._el = el; - }); - - describe('#_onStep', function () { - it("sets element position and fires step event if it is able to get current position", function () { - var point = new L.Point(5, 5, true); - sinon.stub(this.subject, '_getPos').returns(point); - this.subject.fire = sinon.stub(); - this.subject._onStep(); - expect(this.subject.fire.withArgs('step').calledOnce).to.be(true); - expect(L.DomUtil.getPosition(this.subject._el)).to.be(point); - }); - - it('stops transition if a position returned', function () { - sinon.stub(this.subject, '_onTransitionEnd'); - sinon.stub(this.subject, '_getPos').returns(undefined); - this.subject._onStep(); - expect(this.subject._onTransitionEnd.calledOnce).to.be(true); - }); - }); -}); diff --git a/src/dom/PosAnimation.Timer.js b/src/dom/PosAnimation.Timer.js index 52faf981..a2013a4f 100644 --- a/src/dom/PosAnimation.Timer.js +++ b/src/dom/PosAnimation.Timer.js @@ -1,9 +1,8 @@ /* - * L.PosAnimation fallback implementation that powers Leaflet pan animations - * in browsers that don't support CSS3 Transitions. + * L.PosAnimation powers Leaflet pan animations internally. */ -L.PosAnimation = L.DomUtil.TRANSITION ? L.PosAnimation : L.PosAnimation.extend({ +L.PosAnimation = L.Evented.extend({ run: function (el, newPos, duration, easeLinearity) { // (HTMLElement, Point[, Number, Number]) this.stop();