55 lines
1.6 KiB
HTML
55 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Leaflet debug page</title>
|
|
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
|
|
|
|
<script src="../leaflet-include.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="map" style="width: 500px; height: 500px;"></div>
|
|
|
|
<button onclick="javascript:capture1();">Capture Bounds 1</button>
|
|
<button onclick="javascript:capture2();">Capture Bounds 2</button>
|
|
<button onclick="javascript:testBounds();">Test Bounds</button>
|
|
|
|
<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',
|
|
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
|
|
bounds = new L.LatLngBounds(new L.LatLng(49.5, -11.3), new L.LatLng(61.2, 2.5));
|
|
|
|
var bounds1, bounds2;
|
|
|
|
var map = new L.Map('map', {
|
|
center: bounds.getCenter(),
|
|
zoom: 7,
|
|
layers: [cloudmade],
|
|
maxBounds: bounds
|
|
});
|
|
|
|
function capture1 () {
|
|
bounds1 = map.getBounds();
|
|
}
|
|
|
|
function capture2() {
|
|
bounds2 = map.getBounds();
|
|
}
|
|
|
|
function testBounds() {
|
|
if (!(bounds1 && bounds2)) {
|
|
alert("Bounds 1 and 2 have not been set");
|
|
return;
|
|
}
|
|
alert("Bounds 1 " + (bounds1.equals(bounds2) ? "equals": "does not equal") + " bounds 2.")
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |