[Pkg-javascript-commits] [leaflet-markercluster] 148/219: Separated code for singleMarkerMode refresh
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 845f7023662576a90766c6c5341918476b9fbeb3
Author: ghybs <ghybs1 at gmail.com>
Date: Mon Oct 19 13:52:18 2015 +0400
Separated code for singleMarkerMode refresh
into a dedicated private method, as it has nothing to do in `_flagParentsIconsNeedUpdate()`.
---
src/MarkerClusterGroup.Refresh.js | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/src/MarkerClusterGroup.Refresh.js b/src/MarkerClusterGroup.Refresh.js
index c04838f..11f8ccd 100644
--- a/src/MarkerClusterGroup.Refresh.js
+++ b/src/MarkerClusterGroup.Refresh.js
@@ -8,7 +8,8 @@
L.MarkerClusterGroup.include({
/**
- * Updates all clusters (and their icon) which are parents of the given marker(s).
+ * Updates the icon of all clusters which are parents of the given marker(s).
+ * In singleMarkerMode, also updates the given marker(s) icon.
* @param layers L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)|
* L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent
* clusters need to be updated. If not provided, retrieves all child markers of this.
@@ -29,6 +30,11 @@ L.MarkerClusterGroup.include({
this._flagParentsIconsNeedUpdate(layers);
this._refreshClustersIcons();
+ // In case of singleMarkerMode, also re-draw the markers.
+ if (this.options.singleMarkerMode) {
+ this._refreshSingleMarkerModeMarkers(layers);
+ }
+
return this;
},
@@ -38,7 +44,7 @@ L.MarkerClusterGroup.include({
* @private
*/
_flagParentsIconsNeedUpdate: function (layers) {
- var parent, id;
+ var id, parent;
// Assumes layers is an Array or an Object whose prototype is non-enumerable.
for (id in layers) {
@@ -53,17 +59,6 @@ L.MarkerClusterGroup.include({
parent = parent.__parent;
}
}
-
- // In case of singleMarkerMode, also re-draw the markers.
- if (this.options.singleMarkerMode) {
- var layer;
-
- for (id in layers) {
- layer = layers[id];
- // Need to re-create the icon first, then re-draw the marker.
- layer.setIcon(this._overrideMarkerIcon(layer));
- }
- }
},
/**
@@ -77,6 +72,22 @@ L.MarkerClusterGroup.include({
c._updateIcon();
}
});
+ },
+
+ /**
+ * Re-draws the icon of the supplied markers.
+ * To be used in singleMarkerMode only.
+ * @param layers Array(L.Marker)|Map(L.Marker) list of markers.
+ * @private
+ */
+ _refreshSingleMarkerModeMarkers: function (layers) {
+ var id, layer;
+
+ for (id in layers) {
+ layer = layers[id];
+ // Need to re-create the icon first, then re-draw the marker.
+ layer.setIcon(this._overrideMarkerIcon(layer));
+ }
}
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list