ditch transition stopping code
This commit is contained in:
parent
70923e6604
commit
23998c1f9c
@ -143,37 +143,6 @@ L.DomUtil = {
|
||||
'translate3d(' + pos.x + 'px,' + pos.y + 'px' + ',0)' + (scale ? ' scale(' + scale + ')' : '');
|
||||
},
|
||||
|
||||
// you can't easily get intermediate values of properties animated with CSS3 Transitions,
|
||||
// we need to parse computed style (in case of transform it returns matrix string)
|
||||
|
||||
//Gets the offset and scale of the given element as set by setTransform
|
||||
getTransform: function (el) {
|
||||
//Only handles scale and translate matrices.
|
||||
//Handling rotation is more complicated and we never set rotation
|
||||
|
||||
//Extract offset and scale from the matrix
|
||||
var style = window.getComputedStyle(el),
|
||||
split = style[L.DomUtil.TRANSFORM].split(/[\(,\)]/);
|
||||
|
||||
//matrix
|
||||
if (split.length === 8) {
|
||||
return {
|
||||
scale: parseFloat(split[1]),
|
||||
offset: L.point(parseFloat(split[5]), parseFloat(split[6]))
|
||||
};
|
||||
}
|
||||
|
||||
//matrix3d
|
||||
if (split.length === 18) {
|
||||
return {
|
||||
scale: parseFloat(split[1]),
|
||||
offset: L.point(parseFloat(split[13]), parseFloat(split[14]))
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
setPosition: function (el, point, no3d) { // (HTMLElement, Point[, Boolean])
|
||||
|
||||
// jshint camelcase: false
|
||||
|
@ -195,22 +195,11 @@ L.Map = L.Evented.extend({
|
||||
},
|
||||
|
||||
stop: function () {
|
||||
|
||||
//zoomPan
|
||||
L.Util.cancelAnimFrame(this._zoomPanFrame);
|
||||
//TODO: Need to fire zoomend if this was what was going on
|
||||
|
||||
//PosAnimation
|
||||
if (this._panAnim && this._panAnim._inProgress) {
|
||||
L.Util.cancelAnimFrame(this._flyToFrame);
|
||||
if (this._panAnim) {
|
||||
this._panAnim.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
//zoomAnimation
|
||||
if (this._animatingZoom) {
|
||||
this._stopAnimatedZoom();
|
||||
return;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// TODO handler.addTo
|
||||
|
@ -42,7 +42,7 @@ L.Map.include({
|
||||
s = easeOut(t) * S;
|
||||
|
||||
if (t <= 1) {
|
||||
this._zoomPanFrame = L.Util.requestAnimFrame(frame, this);
|
||||
this._flyToFrame = L.Util.requestAnimFrame(frame, this);
|
||||
|
||||
this._resetView(
|
||||
this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),
|
||||
|
@ -29,7 +29,7 @@ if (zoomAnimated) {
|
||||
L.Map.include(!zoomAnimated ? {} : {
|
||||
|
||||
_createAnimProxy: function () {
|
||||
|
||||
|
||||
var proxy = this._proxy = L.DomUtil.create('div', 'leaflet-proxy leaflet-zoom-animated');
|
||||
this._panes.mapPane.appendChild(proxy);
|
||||
|
||||
@ -106,16 +106,6 @@ L.Map.include(!zoomAnimated ? {} : {
|
||||
});
|
||||
},
|
||||
|
||||
_stopAnimatedZoom: function () {
|
||||
|
||||
var transform = L.DomUtil.getTransform(this._proxy);
|
||||
|
||||
//Replace the animation end variables with the current zoom/center
|
||||
this._animateToZoom = this.getScaleZoom(transform.scale, 1);
|
||||
this._animateToCenter = this.unproject(transform.offset, this._animateToZoom);
|
||||
|
||||
this._onZoomTransitionEnd();
|
||||
},
|
||||
_onZoomTransitionEnd: function () {
|
||||
|
||||
this._animatingZoom = false;
|
||||
|
Loading…
Reference in New Issue
Block a user