2013-08-17 19:20:12 +08:00
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>
|
|
|
|
On the left Map dragging and worldCopyJump are enabled during initialisation.<br>
|
|
|
|
On the right Map worldCopyJump is enabled. Dragging is enabled by clicking the button.
|
|
|
|
</p>
|
|
|
|
<button id="foo">
|
|
|
|
Click to enable dragging on the right map, then dragging around and watch copying
|
|
|
|
</button><br>
|
|
|
|
<div id="map1" style="height: 300px;width: 400px; float:left;"></div>
|
|
|
|
<div id="map2" style="height: 300px;width: 400px; float:left; margin-left: 10px;"></div>
|
|
|
|
<div style="clear:both"></div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function addLayerAndMarker(map) {
|
2014-03-04 23:54:41 +08:00
|
|
|
var layer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
2013-08-17 19:20:12 +08:00
|
|
|
maxZoom : 18
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
var marker = L.marker([50.5, 30.5]).addTo(map);
|
2013-11-08 22:43:14 +08:00
|
|
|
|
2013-08-17 19:20:12 +08:00
|
|
|
}
|
|
|
|
var map1 = new L.Map('map1', {
|
|
|
|
center : new L.LatLng(45.50144, -122.67599),
|
|
|
|
zoom : 0,
|
|
|
|
dragging : true,
|
|
|
|
worldCopyJump : true
|
|
|
|
});
|
|
|
|
var map2 = new L.Map('map2', {
|
|
|
|
center : new L.LatLng(45.50144, -122.67599),
|
|
|
|
zoom : 0,
|
|
|
|
dragging : false,
|
|
|
|
worldCopyJump : true
|
|
|
|
});
|
2016-04-29 17:35:50 +08:00
|
|
|
document.getElementById("foo").addEventListener('click', function() {
|
|
|
|
map2.dragging.enable();
|
|
|
|
});
|
2013-08-17 19:20:12 +08:00
|
|
|
|
|
|
|
addLayerAndMarker(map1);
|
|
|
|
addLayerAndMarker(map2);
|
2013-11-08 22:43:14 +08:00
|
|
|
|
2013-08-17 19:20:12 +08:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|