Merge pull request #759 from danzel/zoom-marker-hack-fix

Zoom Marker Hack Fix
This commit is contained in:
Vladimir Agafonkin 2012-07-04 16:09:11 -07:00
commit 7ea7b144f9
6 changed files with 24 additions and 11 deletions

View File

@ -54,7 +54,7 @@
webkit3d: webkit3d,
gecko3d: gecko3d,
opera3d: opera3d,
any3d: ie3d || webkit3d || gecko3d || opera3d,
any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d),
mobile: mobile,
mobileWebkit: mobile && webkit,

View File

@ -23,7 +23,7 @@ L.ImageOverlay = L.Class.extend({
map.on('viewreset', this._reset, this);
if (map.options.zoomAnimation) {
if (map.options.zoomAnimation && L.Browser.any3d) {
map.on('zoomanim', this._animateZoom, this);
}
@ -48,8 +48,10 @@ L.ImageOverlay = L.Class.extend({
_initImage: function () {
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';
} else {
this._image.className += ' leaflet-zoom-hide';
}
this._updateOpacity();

View File

@ -47,7 +47,7 @@ L.Icon = L.Class.extend({
anchor._add(options.shadowOffset);
}
img.className = 'leaflet-marker-' + name + ' ' + options.className + ' leaflet-zoom-animated';
img.className = 'leaflet-marker-' + name + ' ' + options.className;
if (anchor) {
img.style.marginLeft = (-anchor.x) + 'px';

View File

@ -25,12 +25,21 @@ L.Marker = L.Class.extend({
map.on('viewreset', this.update, this);
if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
map.on('zoomanim', this._animateZoom, this);
}
this._initIcon();
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) {

View File

@ -133,13 +133,15 @@ L.Map.include({
this._pathRoot = L.Path.prototype._createElement('svg');
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.on({
'zoomanim': this._animatePathZoom,
'zoomend': this._endPathZoom
});
} else {
this._pathRoot.setAttribute('class', ' leaflet-zoom-hide');
}
this.on('moveend', this._updateSvgViewport);

View File

@ -17,7 +17,7 @@ L.Map = L.Class.extend({
fadeAnimation: L.DomUtil.TRANSITION && !L.Browser.android23,
trackResize: true,
markerZoomAnimation: true
markerZoomAnimation: L.DomUtil.TRANSITION && L.Browser.any3d
},
initialize: function (id, options) { // (HTMLElement or String, Object)