[Pkg-javascript-commits] [leaflet-markercluster] 460/479: use getAllChildMarkers in this example. fixes #270

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:01:07 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 6835a777cc5793553a9256ab4dfadb4f2636642f
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Dec 18 11:24:26 2013 +1300

    use getAllChildMarkers in this example. fixes #270
---
 example/marker-clustering-custom.html | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/example/marker-clustering-custom.html b/example/marker-clustering-custom.html
index e102fef..107916a 100644
--- a/example/marker-clustering-custom.html
+++ b/example/marker-clustering-custom.html
@@ -40,7 +40,12 @@
 		var markers = L.markerClusterGroup({
 			maxClusterRadius: 120,
 			iconCreateFunction: function (cluster) {
-				return L.divIcon({ html: cluster.getChildCount(), className: 'mycluster', iconSize: L.point(40, 40) });
+				var markers = cluster.getAllChildMarkers();
+				var n = 0;
+				for (var i = 0; i < markers.length; i++) {
+					n += markers[i].number;
+				}
+				return L.divIcon({ html: n, className: 'mycluster', iconSize: L.point(40, 40) });
 			},
 			//Disable all of the defaults:
 			spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false
@@ -49,7 +54,8 @@
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = L.marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map), { title: i });
+				m.number = i;
 				markers.addLayer(m);
 			}
 			return false;

-- 
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