mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
Fade markers in during a zoom in.
This commit is contained in:
@@ -161,9 +161,9 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
nm._backupLatlng = nm.getLatLng();
|
nm._backupLatlng = nm.getLatLng();
|
||||||
|
|
||||||
nm.setLatLng(startPos);
|
nm.setLatLng(startPos);
|
||||||
|
nm.setOpacity(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
L.FeatureGroup.prototype.addLayer.call(this._group, nm);
|
L.FeatureGroup.prototype.addLayer.call(this._group, nm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -444,6 +444,16 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Immediately fire an event to update the opacity (If we immediately set it they won't animate)
|
||||||
|
setTimeout(function () {
|
||||||
|
for (i in me._layers) {
|
||||||
|
var n = me._layers[i];
|
||||||
|
|
||||||
|
if (!(n instanceof L.MarkerCluster) && n._icon) {
|
||||||
|
n.setOpacity(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
|
||||||
this._inZoomAnimation++;
|
this._inZoomAnimation++;
|
||||||
//Start up a function to update the positions of the just added clusters/markers
|
//Start up a function to update the positions of the just added clusters/markers
|
||||||
@@ -480,7 +490,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
//TODO: Maybe use the transition timing stuff to make this more reliable
|
//Immediately fire an event to update the opacity (If we immediately set it they won't animate)
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
for (i = 0; i < newClusters.length; i++) {
|
for (i = 0; i < newClusters.length; i++) {
|
||||||
var n = newClusters[i];
|
var n = newClusters[i];
|
||||||
@@ -490,6 +500,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
//TODO: Maybe use the transition timing stuff to make this more reliable
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
||||||
map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
|
map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
|
||||||
|
|||||||
Reference in New Issue
Block a user