Merge pull request #759 from danzel/zoom-marker-hack-fix
Zoom Marker Hack Fix
This commit is contained in:
commit
7ea7b144f9
@ -54,7 +54,7 @@
|
|||||||
webkit3d: webkit3d,
|
webkit3d: webkit3d,
|
||||||
gecko3d: gecko3d,
|
gecko3d: gecko3d,
|
||||||
opera3d: opera3d,
|
opera3d: opera3d,
|
||||||
any3d: ie3d || webkit3d || gecko3d || opera3d,
|
any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d),
|
||||||
|
|
||||||
mobile: mobile,
|
mobile: mobile,
|
||||||
mobileWebkit: mobile && webkit,
|
mobileWebkit: mobile && webkit,
|
||||||
|
@ -23,7 +23,7 @@ L.ImageOverlay = L.Class.extend({
|
|||||||
|
|
||||||
map.on('viewreset', this._reset, this);
|
map.on('viewreset', this._reset, this);
|
||||||
|
|
||||||
if (map.options.zoomAnimation) {
|
if (map.options.zoomAnimation && L.Browser.any3d) {
|
||||||
map.on('zoomanim', this._animateZoom, this);
|
map.on('zoomanim', this._animateZoom, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,10 @@ L.ImageOverlay = L.Class.extend({
|
|||||||
_initImage: function () {
|
_initImage: function () {
|
||||||
this._image = L.DomUtil.create('img', 'leaflet-image-layer');
|
this._image = L.DomUtil.create('img', 'leaflet-image-layer');
|
||||||
|
|
||||||
if (this._map.options.zoomAnimation) {
|
if (this._map.options.zoomAnimation && L.Browser.any3d) {
|
||||||
this._image.className += ' leaflet-zoom-animated';
|
this._image.className += ' leaflet-zoom-animated';
|
||||||
|
} else {
|
||||||
|
this._image.className += ' leaflet-zoom-hide';
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateOpacity();
|
this._updateOpacity();
|
||||||
|
@ -47,7 +47,7 @@ L.Icon = L.Class.extend({
|
|||||||
anchor._add(options.shadowOffset);
|
anchor._add(options.shadowOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
img.className = 'leaflet-marker-' + name + ' ' + options.className + ' leaflet-zoom-animated';
|
img.className = 'leaflet-marker-' + name + ' ' + options.className;
|
||||||
|
|
||||||
if (anchor) {
|
if (anchor) {
|
||||||
img.style.marginLeft = (-anchor.x) + 'px';
|
img.style.marginLeft = (-anchor.x) + 'px';
|
||||||
|
@ -25,12 +25,21 @@ L.Marker = L.Class.extend({
|
|||||||
|
|
||||||
map.on('viewreset', this.update, this);
|
map.on('viewreset', this.update, this);
|
||||||
|
|
||||||
if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
|
|
||||||
map.on('zoomanim', this._animateZoom, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._initIcon();
|
this._initIcon();
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
|
if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
|
||||||
|
map.on('zoomanim', this._animateZoom, this);
|
||||||
|
this._icon.className += ' leaflet-zoom-animated';
|
||||||
|
if (this._shadow) {
|
||||||
|
this._shadow.className += ' leaflet-zoom-animated';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this._icon.className += ' leaflet-zoom-hide';
|
||||||
|
if (this._shadow) {
|
||||||
|
this._shadow.className += ' leaflet-zoom-hide';
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function (map) {
|
onRemove: function (map) {
|
||||||
|
@ -133,13 +133,15 @@ L.Map.include({
|
|||||||
this._pathRoot = L.Path.prototype._createElement('svg');
|
this._pathRoot = L.Path.prototype._createElement('svg');
|
||||||
this._panes.overlayPane.appendChild(this._pathRoot);
|
this._panes.overlayPane.appendChild(this._pathRoot);
|
||||||
|
|
||||||
if (this.options.zoomAnimation) {
|
if (this.options.zoomAnimation && L.Browser.any3d) {
|
||||||
this._pathRoot.setAttribute('class', ' leaflet-zoom-animated');
|
this._pathRoot.setAttribute('class', ' leaflet-zoom-animated');
|
||||||
|
|
||||||
this.on({
|
this.on({
|
||||||
'zoomanim': this._animatePathZoom,
|
'zoomanim': this._animatePathZoom,
|
||||||
'zoomend': this._endPathZoom
|
'zoomend': this._endPathZoom
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this._pathRoot.setAttribute('class', ' leaflet-zoom-hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.on('moveend', this._updateSvgViewport);
|
this.on('moveend', this._updateSvgViewport);
|
||||||
|
@ -17,7 +17,7 @@ L.Map = L.Class.extend({
|
|||||||
|
|
||||||
fadeAnimation: L.DomUtil.TRANSITION && !L.Browser.android23,
|
fadeAnimation: L.DomUtil.TRANSITION && !L.Browser.android23,
|
||||||
trackResize: true,
|
trackResize: true,
|
||||||
markerZoomAnimation: true
|
markerZoomAnimation: L.DomUtil.TRANSITION && L.Browser.any3d
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (id, options) { // (HTMLElement or String, Object)
|
initialize: function (id, options) { // (HTMLElement or String, Object)
|
||||||
|
Loading…
Reference in New Issue
Block a user