[Pkg-javascript-commits] [leaflet-markercluster] 369/479: Add factory method and use them everywhere. Fixes #21

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:58 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 04b71ed450259dc62d39f68d9736b60fa30e04e7
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jun 14 17:08:22 2013 +1200

    Add factory method and use them everywhere. Fixes #21
---
 example/geojson.html                                 |  2 +-
 example/marker-clustering-convexhull.html            | 14 +++++++-------
 example/marker-clustering-custom.html                | 18 +++++++++---------
 example/marker-clustering-everything.html            | 16 ++++++++--------
 example/marker-clustering-realworld-maxzoom.388.html | 10 +++++-----
 example/marker-clustering-realworld-mobile.388.html  | 10 +++++-----
 example/marker-clustering-realworld.10000.html       | 10 +++++-----
 example/marker-clustering-realworld.388.html         | 10 +++++-----
 example/marker-clustering-realworld.50000.html       | 12 ++++++------
 example/marker-clustering-singlemarkermode.html      | 12 ++++++------
 example/marker-clustering-spiderfier.html            | 12 ++++++------
 example/marker-clustering-zoomtobounds.html          | 12 ++++++------
 example/marker-clustering-zoomtoshowlayer.html       | 10 +++++-----
 src/MarkerClusterGroup.js                            |  4 ++++
 14 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/example/geojson.html b/example/geojson.html
index 4a02afa..04ab0a0 100644
--- a/example/geojson.html
+++ b/example/geojson.html
@@ -41,7 +41,7 @@
 		var map = L.map('map')
 				.addLayer(cloudmade);
 
-		var markers = new L.MarkerClusterGroup();
+		var markers = L.markerClusterGroup();
 
 		var geoJsonLayer = L.geoJson(geoJsonData, {
 			onEachFeature: function (feature, layer) {
diff --git a/example/marker-clustering-convexhull.html b/example/marker-clustering-convexhull.html
index ba3aa20..942350d 100644
--- a/example/marker-clustering-convexhull.html
+++ b/example/marker-clustering-convexhull.html
@@ -24,16 +24,16 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({ spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false });
+		var markers = L.markerClusterGroup({ spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false });
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markers.addLayer(m);
 			}
 			return false;
@@ -45,7 +45,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
@@ -56,7 +56,7 @@
 			if (polygon) {
 				map.removeLayer(polygon);
 			}
-			polygon = new L.Polygon(a.layer.getConvexHull());
+			polygon = L.polygon(a.layer.getConvexHull());
 			map.addLayer(polygon);
 		});
 
diff --git a/example/marker-clustering-custom.html b/example/marker-clustering-custom.html
index 3b2d331..30a3db7 100644
--- a/example/marker-clustering-custom.html
+++ b/example/marker-clustering-custom.html
@@ -31,17 +31,17 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
 
 		//Custom radius and icon create function
-		var markers = new L.MarkerClusterGroup({
+		var markers = L.markerClusterGroup({
 			maxClusterRadius: 120,
 			iconCreateFunction: function (cluster) {
-				return new L.DivIcon({ html: cluster.getChildCount(), className: 'mycluster', iconSize: new L.Point(40, 40) });
+				return L.divIcon({ html: cluster.getChildCount(), className: 'mycluster', iconSize: L.point(40, 40) });
 			},
 			//Disable all of the defaults:
 			spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false
@@ -50,7 +50,7 @@
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markers.addLayer(m);
 			}
 			return false;
@@ -59,7 +59,7 @@
 			for (var i = 0, latlngs = [], len = 20; i < len; i++) {
 				latlngs.push(getRandomLatLng(map));
 			}
-			var path = new L.Polyline(latlngs);
+			var path = L.polyline(latlngs);
 			map.addLayer(path);
 		}
 		function getRandomLatLng(map) {
@@ -69,7 +69,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
@@ -97,7 +97,7 @@
 
 			a.layer.setOpacity(0.2);
 			shownLayer = a.layer;
-			polygon = new L.Polygon(a.layer.getConvexHull());
+			polygon = L.polygon(a.layer.getConvexHull());
 			map.addLayer(polygon);
 		});
 		markers.on('clustermouseout', removePolygon);
diff --git a/example/marker-clustering-everything.html b/example/marker-clustering-everything.html
index 10d3ed9..0056fc1 100644
--- a/example/marker-clustering-everything.html
+++ b/example/marker-clustering-everything.html
@@ -24,17 +24,17 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({ animateAddingMarkers : true });
+		var markers = L.markerClusterGroup({ animateAddingMarkers : true });
 		var markersList = [];
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markersList.push(m);
 				markers.addLayer(m);
 			}
@@ -47,7 +47,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
@@ -66,9 +66,9 @@
 			northEast = bounds.getNorthEast(),
 			lngSpan = northEast.lng - southWest.lng,
 			latSpan = northEast.lat - southWest.lat;
-			var m = new L.Marker(new L.LatLng(
+			var m = L.marker([
 					southWest.lat + latSpan * 0.5,
-					southWest.lng + lngSpan * 0.5));
+					southWest.lng + lngSpan * 0.5]);
 			markersList.push(m);
 			markers.addLayer(m);
 		};
diff --git a/example/marker-clustering-realworld-maxzoom.388.html b/example/marker-clustering-realworld-maxzoom.388.html
index 8bd568c..3284414 100644
--- a/example/marker-clustering-realworld-maxzoom.388.html
+++ b/example/marker-clustering-realworld-maxzoom.388.html
@@ -24,17 +24,17 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(-37.82, 175.24);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(-37.82, 175.24);
 
-		var map = new L.Map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({ disableClusteringAtZoom: 17 });
+		var markers = L.markerClusterGroup({ disableClusteringAtZoom: 17 });
 		
 		for (var i = 0; i < addressPoints.length; i++) {
 			var a = addressPoints[i];
 			var title = a[2];
-			var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+			var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 			marker.bindPopup(title);
 			markers.addLayer(marker);
 		}
diff --git a/example/marker-clustering-realworld-mobile.388.html b/example/marker-clustering-realworld-mobile.388.html
index df0f4be..1a70509 100644
--- a/example/marker-clustering-realworld-mobile.388.html
+++ b/example/marker-clustering-realworld-mobile.388.html
@@ -23,17 +23,17 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(-37.821, 175.22);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(-37.821, 175.22);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup();
+		var markers = L.markerClusterGroup();
 
 		for (var i = 0; i < addressPoints.length; i++) {
 			var a = addressPoints[i];
 			var title = a[2];
-			var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+			var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 			marker.bindPopup(title);
 			markers.addLayer(marker);
 		}
diff --git a/example/marker-clustering-realworld.10000.html b/example/marker-clustering-realworld.10000.html
index ed200a8..b6c886d 100644
--- a/example/marker-clustering-realworld.10000.html
+++ b/example/marker-clustering-realworld.10000.html
@@ -25,16 +25,16 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(-37.89, 175.46);
-		var map = new L.Map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(-37.89, 175.46);
+		var map = L.map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup();
+		var markers = L.markerClusterGroup();
 		
 		for (var i = 0; i < addressPoints.length; i++) {
 			var a = addressPoints[i];
 			var title = a[2];
-			var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+			var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 			marker.bindPopup(title);
 			markers.addLayer(marker);
 		}
diff --git a/example/marker-clustering-realworld.388.html b/example/marker-clustering-realworld.388.html
index 4306740..1732546 100644
--- a/example/marker-clustering-realworld.388.html
+++ b/example/marker-clustering-realworld.388.html
@@ -24,17 +24,17 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(-37.82, 175.24);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(-37.82, 175.24);
 
-		var map = new L.Map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup();
+		var markers = L.markerClusterGroup();
 		
 		for (var i = 0; i < addressPoints.length; i++) {
 			var a = addressPoints[i];
 			var title = a[2];
-			var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+			var marker = L.marker(new L.LatLng(a[0], a[1]), { title: title });
 			marker.bindPopup(title);
 			markers.addLayer(marker);
 		}
diff --git a/example/marker-clustering-realworld.50000.html b/example/marker-clustering-realworld.50000.html
index 37c0a85..68fe375 100644
--- a/example/marker-clustering-realworld.50000.html
+++ b/example/marker-clustering-realworld.50000.html
@@ -25,12 +25,12 @@
 	<script type="text/javascript">
 			var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			    cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			    cloudmade = new L.TileLayer(cloudmadeUrl, { maxZoom: 17, attribution: cloudmadeAttribution }),
-			    latlng = new L.LatLng(-37.79, 175.27);
+			    cloudmade = L.tileLayer(cloudmadeUrl, { maxZoom: 17, attribution: cloudmadeAttribution }),
+			    latlng = L.latLng(-37.79, 175.27);
 
-			var map = new L.Map('map', { center: latlng, zoom: 13, layers: [cloudmade] });
+			var map = L.map('map', { center: latlng, zoom: 13, layers: [cloudmade] });
 
-			var markers = new L.MarkerClusterGroup();
+			var markers = L.markerClusterGroup();
 
 			var markerList = [];
 
@@ -39,14 +39,14 @@
 			for (var i = 0; i < addressPoints.length; i++) {
 				var a = addressPoints[i];
 				var title = a[2];
-				var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+				var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 				marker.bindPopup(title);
 				markerList.push(marker);
 			}
 			for (var i = 0; i < addressPoints2.length; i++) {
 				var a = addressPoints[i];
 				var title = a[2];
-				var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+				var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 				marker.bindPopup(title);
 				markerList.push(marker);
 			}
diff --git a/example/marker-clustering-singlemarkermode.html b/example/marker-clustering-singlemarkermode.html
index 3f52341..e733929 100644
--- a/example/marker-clustering-singlemarkermode.html
+++ b/example/marker-clustering-singlemarkermode.html
@@ -23,16 +23,16 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({ singleMarkerMode: true});
+		var markers = L.markerClusterGroup({ singleMarkerMode: true});
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markers.addLayer(m);
 			}
 			return false;
@@ -44,7 +44,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
diff --git a/example/marker-clustering-spiderfier.html b/example/marker-clustering-spiderfier.html
index 877b0b8..5cbbe14 100644
--- a/example/marker-clustering-spiderfier.html
+++ b/example/marker-clustering-spiderfier.html
@@ -24,16 +24,16 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({ spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false });
+		var markers = L.markerClusterGroup({ spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false });
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markers.addLayer(m);
 			}
 			return false;
@@ -45,7 +45,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
diff --git a/example/marker-clustering-zoomtobounds.html b/example/marker-clustering-zoomtobounds.html
index b9410dc..99fc7ce 100644
--- a/example/marker-clustering-zoomtobounds.html
+++ b/example/marker-clustering-zoomtobounds.html
@@ -23,16 +23,16 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(50.5, 30.51);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(50.5, 30.51);
 
-		var map = new L.Map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 15, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup({spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false});
+		var markers = L.markerClusterGroup({spiderfyOnMaxZoom: false, showCoverageOnHover: false, zoomToBoundsOnClick: false});
 
 		function populate() {
 			for (var i = 0; i < 100; i++) {
-				var m = new L.Marker(getRandomLatLng(map));
+				var m = L.marker(getRandomLatLng(map));
 				markers.addLayer(m);
 			}
 			return false;
@@ -44,7 +44,7 @@
 				lngSpan = northEast.lng - southWest.lng,
 				latSpan = northEast.lat - southWest.lat;
 
-			return new L.LatLng(
+			return L.latLng(
 					southWest.lat + latSpan * Math.random(),
 					southWest.lng + lngSpan * Math.random());
 		}
diff --git a/example/marker-clustering-zoomtoshowlayer.html b/example/marker-clustering-zoomtoshowlayer.html
index b5883ad..0ac114c 100644
--- a/example/marker-clustering-zoomtoshowlayer.html
+++ b/example/marker-clustering-zoomtoshowlayer.html
@@ -25,19 +25,19 @@
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
 			cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points &copy 2012 LINZ',
-			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
-			latlng = new L.LatLng(-37.82, 175.24);
+			cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
+			latlng = L.latLng(-37.82, 175.24);
 
-		var map = new L.Map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
+		var map = L.map('map', {center: latlng, zoom: 13, layers: [cloudmade]});
 
-		var markers = new L.MarkerClusterGroup();
+		var markers = L.markerClusterGroup();
 		var markerList = [];
 
 		function populate() {
 			for (var i = 0; i < addressPoints.length; i++) {
 				var a = addressPoints[i];
 				var title = a[2];
-				var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
+				var marker = L.marker(L.latLng(a[0], a[1]), { title: title });
 				marker.bindPopup(title);
 				markers.addLayer(marker);
 				markerList.push(marker);
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index cfa88c3..8176db4 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -906,3 +906,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		L.Util.falseFn(document.body.offsetWidth);
 	}
 });
+
+L.markerClusterGroup = function (options) {
+	return new L.MarkerClusterGroup(options);
+};
\ No newline at end of file

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