replace CSS transitions in pan animations with frames
This commit is contained in:
parent
66c13bc94c
commit
a33eff73f0
@ -227,19 +227,13 @@ var deps = {
|
|||||||
AnimationPan: {
|
AnimationPan: {
|
||||||
src: [
|
src: [
|
||||||
'dom/DomEvent.js',
|
'dom/DomEvent.js',
|
||||||
'dom/PosAnimation.js',
|
'dom/PosAnimation.Timer.js',
|
||||||
'map/anim/Map.PanAnimation.js'
|
'map/anim/Map.PanAnimation.js'
|
||||||
],
|
],
|
||||||
heading: 'Animation',
|
heading: 'Animation',
|
||||||
desc: 'Core panning animation support.'
|
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: {
|
AnimationZoom: {
|
||||||
src: [
|
src: [
|
||||||
'map/anim/Map.ZoomAnimation.js',
|
'map/anim/Map.ZoomAnimation.js',
|
||||||
|
@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* L.PosAnimation fallback implementation that powers Leaflet pan animations
|
* L.PosAnimation powers Leaflet pan animations internally.
|
||||||
* in browsers that don't support CSS3 Transitions.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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])
|
run: function (el, newPos, duration, easeLinearity) { // (HTMLElement, Point[, Number, Number])
|
||||||
this.stop();
|
this.stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user