add DomUtil.setTransform for translate+scale ops
This commit is contained in:
parent
30f86b11e3
commit
758679ab69
@ -141,6 +141,10 @@ L.DomUtil = {
|
|||||||
point.y + 'px' + (is3d ? ',0)' : ')');
|
point.y + 'px' + (is3d ? ',0)' : ')');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTransform: function (el, point, scale) {
|
||||||
|
el.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(point) + (scale ? ' scale(' + scale + ')' : '');
|
||||||
|
},
|
||||||
|
|
||||||
getScaleString: function (scale, origin) {
|
getScaleString: function (scale, origin) {
|
||||||
return L.DomUtil.getTranslateString(origin.multiplyBy(1 - scale)) + ' scale(' + scale + ') ';
|
return L.DomUtil.getTranslateString(origin.multiplyBy(1 - scale)) + ' scale(' + scale + ') ';
|
||||||
},
|
},
|
||||||
@ -151,7 +155,7 @@ L.DomUtil = {
|
|||||||
el._leaflet_pos = point;
|
el._leaflet_pos = point;
|
||||||
|
|
||||||
if (!disable3D && L.Browser.any3d) {
|
if (!disable3D && L.Browser.any3d) {
|
||||||
el.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(point);
|
L.DomUtil.setTransform(el, point);
|
||||||
} else {
|
} else {
|
||||||
el.style.left = point.x + 'px';
|
el.style.left = point.x + 'px';
|
||||||
el.style.top = point.y + 'px';
|
el.style.top = point.y + 'px';
|
||||||
|
@ -92,7 +92,7 @@ L.ImageOverlay = L.Layer.extend({
|
|||||||
size = map._latLngToNewLayerPoint(this._bounds.getSouthEast(), e.zoom, e.center)._subtract(topLeft),
|
size = map._latLngToNewLayerPoint(this._bounds.getSouthEast(), e.zoom, e.center)._subtract(topLeft),
|
||||||
origin = topLeft._add(size._multiplyBy((1 - 1 / scale) / 2));
|
origin = topLeft._add(size._multiplyBy((1 - 1 / scale) / 2));
|
||||||
|
|
||||||
image.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(origin) + ' scale(' + scale + ') ';
|
L.DomUtil.setTransform(image, origin, scale);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reset: function () {
|
_reset: function () {
|
||||||
|
@ -498,7 +498,7 @@ L.GridLayer = L.Layer.extend({
|
|||||||
|
|
||||||
if (map && !map._animatingZoom && !map.touchZoom._zooming) {
|
if (map && !map._animatingZoom && !map.touchZoom._zooming) {
|
||||||
this._bgBuffer.innerHTML = '';
|
this._bgBuffer.innerHTML = '';
|
||||||
this._bgBuffer.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString();
|
L.DomUtil.setTransform(this._bgBuffer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ L.GridLayer = L.Layer.extend({
|
|||||||
|
|
||||||
// prepare the buffer to become the front tile pane
|
// prepare the buffer to become the front tile pane
|
||||||
bg.style.visibility = 'hidden';
|
bg.style.visibility = 'hidden';
|
||||||
bg.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString();
|
L.DomUtil.setTransform(bg);
|
||||||
|
|
||||||
// switch out the current layer to be the new bg layer (and vice-versa)
|
// switch out the current layer to be the new bg layer (and vice-versa)
|
||||||
this._tileContainer = bg;
|
this._tileContainer = bg;
|
||||||
|
@ -47,7 +47,7 @@ L.Renderer = L.Layer.extend({
|
|||||||
var scale = this._map.getZoomScale(e.zoom),
|
var scale = this._map.getZoomScale(e.zoom),
|
||||||
offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale)._add(this._bounds.min);
|
offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale)._add(this._bounds.min);
|
||||||
|
|
||||||
this._container.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(offset) + ' scale(' + scale + ') ';
|
L.DomUtil.setTransform(this._container, offset, scale);
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function () {
|
_update: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user