[Pkg-javascript-commits] [leaflet-markercluster] 349/479: Add broken example from @bpavot in #160

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:50 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 fc3edf295875099520580605cab4bb0b29666460
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Apr 26 09:52:52 2013 +1200

    Add broken example from @bpavot in #160
---
 .../removelayer-after-remove-from-map.html         | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/example/old-bugs/removelayer-after-remove-from-map.html b/example/old-bugs/removelayer-after-remove-from-map.html
new file mode 100644
index 0000000..051faf8
--- /dev/null
+++ b/example/old-bugs/removelayer-after-remove-from-map.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<title>Leaflet debug page</title>
+
+	<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.css" />
+	<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.ie.css" /><![endif]-->
+	<script src="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet-src.js"></script>
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<link rel="stylesheet" href="../screen.css" />
+
+	<link rel="stylesheet" href="../../dist/MarkerCluster.css" />
+	<link rel="stylesheet" href="../../dist/MarkerCluster.Default.css" />
+	<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/MarkerCluster.Default.ie.css" /><![endif]-->
+	<script src="../../src/DistanceGrid.js"></script>
+	<script src="../../src/MarkerCluster.js"></script>
+	<script src="../../src/MarkerClusterGroup.js"></script>
+	<script src="../../src/MarkerCluster.QuickHull.js"></script>
+	<script src="../../src/MarkerCluster.Spiderfier.js"></script>
+</head>
+<body>
+
+	<div id="map"></div>
+	<a href="#" onclick="swapLayers()">1 - Swap layers</a><br>
+	<a href="#" onclick="removeMarker()">2 - Remove all markers</a><br>
+	<a href="#" onclick="swapLayers()">3 - Swap layers again => Marker is still there<a/></br>
+	
+	<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/160">#160</a>. Click 1,2,3. There should be nothing on the map.</span><br/>
+	<script type="text/javascript">
+	
+		var map = new L.Map('map');
+
+		var tilesLayer = new L.TileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png');
+		map.addLayer(tilesLayer);
+
+		var objectBounds = [[44.98131207805678, 6.0726203025917], [44.981459751363204, 6.073026722623153]];
+		map.fitBounds(new L.LatLngBounds(objectBounds));
+
+		var markers1 = new L.MarkerClusterGroup();
+		var markers2 = new L.MarkerClusterGroup();
+
+		map.addLayer(markers1);
+
+		var aMarker = new L.Marker(new L.LatLng(44.9813, 6.072620));
+		var anotherMarker = new L.Marker(new L.LatLng(44.9814, 6.072621));
+
+		markers1.addLayer(aMarker);
+		markers2.addLayer(anotherMarker);
+
+		swapLayers = function(){
+			if (map.hasLayer(markers1)){
+				map.removeLayer(markers1);
+				map.addLayer(markers2);
+			}else{
+				map.removeLayer(markers2);
+				map.addLayer(markers1);
+			}
+		};
+
+		removeMarker = function(){
+			markers1.removeLayer(aMarker);
+			markers2.removeLayer(anotherMarker);
+		};
+
+
+	</script>
+</body>
+</html>

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