mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-30 14:13:38 +01:00
Merge pull request #3035 from reviiii/patch-1
Add animations to customMarkers
This commit is contained in:
commit
4f2cfdb11d
@ -37,6 +37,9 @@ L.CustomMarker = L.Class.extend({
|
|||||||
|
|
||||||
map.on('viewreset', this._reset, this);
|
map.on('viewreset', this._reset, this);
|
||||||
this._reset();
|
this._reset();
|
||||||
|
if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
|
||||||
|
map.on('zoomanim', this._animateZoom, this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function(map) {
|
onRemove: function(map) {
|
||||||
@ -61,6 +64,12 @@ L.CustomMarker = L.Class.extend({
|
|||||||
this._reset();
|
this._reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_animateZoom: function (opt) {
|
||||||
|
var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center);
|
||||||
|
L.DomUtil.setPosition(this._element, pos);
|
||||||
|
this._element.style.zIndex = pos.y;
|
||||||
|
},
|
||||||
|
|
||||||
_reset: function() {
|
_reset: function() {
|
||||||
if(this._map == null)
|
if(this._map == null)
|
||||||
return;
|
return;
|
||||||
@ -97,6 +106,9 @@ L.CustomMarker = L.Class.extend({
|
|||||||
this.dragging.enable();
|
this.dragging.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var animation = (map.options.zoomAnimation && map.options.markerZoomAnimation);
|
||||||
|
if (this._element)
|
||||||
|
this._element.className += animation ? ' leaflet-zoom-animated' : ' leaflet-zoom-hide';
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseClick: function(e) {
|
_onMouseClick: function(e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user