| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Leaflet debug page</title> |
| 5 |
|
| 6 |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ==" crossorigin="" /> |
| 7 |
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js" integrity="sha512-WXoSHqw/t26DszhdMhOXOkI7qCiv5QWXhH9R7CgvgZMHz1ImlkVQ3uNsiQKu5wwbbxtPzFXd1hK4tzno2VqhpA==" crossorigin=""></script> |
| 8 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 9 |
<link rel="stylesheet" href="../screen.css" /> |
| 10 |
|
| 11 |
<link rel="stylesheet" href="../../dist/MarkerCluster.css" /> |
| 12 |
<link rel="stylesheet" href="../../dist/MarkerCluster.Default.css" /> |
| 13 |
<script src="../../src/DistanceGrid.js"></script> |
| 14 |
<script src="../../src/MarkerCluster.js"></script> |
| 15 |
<script src="../../src/MarkerClusterGroup.js"></script> |
| 16 |
<script src="../../src/MarkerCluster.QuickHull.js"></script> |
| 17 |
<script src="../../src/MarkerCluster.Spiderfier.js"></script> |
| 18 |
</head> |
| 19 |
<body> |
| 20 |
|
| 21 |
<div id="map"></div> |
| 22 |
<button id="doit">open popup</button><br/> |
| 23 |
<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/65">#65</a>. Click 2 then click the button. You should be scrolled to the marker, old behaviour would zoom you out.</span><br/> |
| 24 |
<span id="time"></span> |
| 25 |
<script type="text/javascript"> |
| 26 |
|
| 27 |
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 28 |
maxZoom: 18, |
| 29 |
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' |
| 30 |
}), |
| 31 |
latlng = new L.LatLng(50.5, 30.51); |
| 32 |
|
| 33 |
var map = new L.Map('map', {center: latlng, zoom: 15, layers: [tiles]}); |
| 34 |
|
| 35 |
var markers = new L.MarkerClusterGroup(); |
| 36 |
var markersList = []; |
| 37 |
|
| 38 |
var m = new L.Marker(new L.LatLng(50.507, 30.502)); |
| 39 |
m.bindPopup('asdasd'); |
| 40 |
markersList.push(m); |
| 41 |
markers.addLayer(m); |
| 42 |
|
| 43 |
|
| 44 |
m = new L.Marker(new L.LatLng(50.493, 30.518)); |
| 45 |
markersList.push(m); |
| 46 |
markers.addLayer(m); |
| 47 |
|
| 48 |
m = new L.Marker(new L.LatLng(50.493, 30.518)); |
| 49 |
markersList.push(m); |
| 50 |
markers.addLayer(m); |
| 51 |
|
| 52 |
|
| 53 |
map.addLayer(markers); |
| 54 |
|
| 55 |
L.DomUtil.get('doit').onclick = function () { |
| 56 |
markers.zoomToShowLayer(markersList[0], function () { |
| 57 |
markersList[0].openPopup(); |
| 58 |
}); |
| 59 |
}; |
| 60 |
|
| 61 |
</script> |
| 62 |
</body> |
| 63 |
</html> |