replace CSS transitions in pan animations with frames

This commit is contained in:
Vladimir Agafonkin 2014-07-30 17:26:45 +03:00
parent 66c13bc94c
commit a33eff73f0
3 changed files with 3 additions and 37 deletions

View File

@ -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',

View File

@ -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);
});
});
});

View File

@ -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();