[Pkg-javascript-commits] [leaflet-markercluster] 04/18: Refactor(examplePane): assign clusterPane option only if pane is provided

Jonas Smedegaard dr at jones.dk
Sat Jan 6 19:29:06 UTC 2018


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

js pushed a commit to annotated tag debian/1.2.0_dfsg-1
in repository leaflet-markercluster.

commit a256831f2ca47396efea2607975570c4414b24e6
Author: ghybs <ghybs1 at gmail.com>
Date:   Thu Oct 19 08:31:38 2017 +0400

    Refactor(examplePane): assign clusterPane option only if pane is provided
    
    otherwise clusterPane may be undefined, which causes trouble (same for all other Leaflet layers with their `pane` option).
---
 example/marker-clustering-pane.html | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/example/marker-clustering-pane.html b/example/marker-clustering-pane.html
index 505b139..343ca11 100644
--- a/example/marker-clustering-pane.html
+++ b/example/marker-clustering-pane.html
@@ -51,19 +51,25 @@
 		var markersB = createMarkerClusterGroup('myclusterB', 'paneB');
 
 		function createMarkerClusterGroup(className, pane) {
-		    var mcg = L.markerClusterGroup({
-                maxClusterRadius: 120,
-                iconCreateFunction: function (cluster) {
-                    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: className, iconSize: L.point(40, 40) });
-                },
-                //Disable all of the defaults & specify the pane:
-                spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false, clusterPane: pane
-            });
+			var options = {
+				maxClusterRadius: 120,
+				iconCreateFunction: function (cluster) {
+					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: className, iconSize: L.point(40, 40) });
+				},
+				//Disable all of the defaults & specify the pane:
+				spiderfyOnMaxZoom: false,
+				showCoverageOnHover: false,
+				zoomToBoundsOnClick: false
+			};
+			if (pane) {
+				options.clusterPane = pane;
+			}
+		    var mcg = L.markerClusterGroup(options);
 		    return(mcg);
         }
 

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