64 lines
1.4 KiB
HTML
64 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Leaflet debug page</title>
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
|
<script src="../leaflet-include.js"></script>
|
|
<style>
|
|
#map {
|
|
margin: 256px;
|
|
width: auto;
|
|
overflow: visible
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
The CSS in this page makes the boundaries of the GridLayer tiles visible. Tiles which do not overlap the map bounds shall not be shown, even at fractional zoom levels.
|
|
|
|
<button onclick='map.zoomIn(0.1)'> Zoom + 0.1 </button>
|
|
<button onclick='map.zoomOut(0.1)'> Zoom - 0.1 </button>
|
|
|
|
<div id="map" class="map"></div>
|
|
|
|
<script type="text/javascript">
|
|
var mapopts = {
|
|
center: [35, -122],
|
|
zoom: 5.7,
|
|
zoomSnap: 0.1
|
|
};
|
|
|
|
var map = L.map('map', mapopts);
|
|
|
|
var grid = L.gridLayer({
|
|
attribution: 'Grid Layer',
|
|
tileSize: L.point(150, 80)
|
|
});
|
|
|
|
grid.createTile = function (coords, done) {
|
|
var tile = document.createElement('div');
|
|
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
|
|
tile.style.border = '2px solid red';
|
|
// tile.style.background = 'white';
|
|
|
|
// test async
|
|
setTimeout(function () {
|
|
done(null, tile);
|
|
}, 0);
|
|
|
|
return tile;
|
|
};
|
|
|
|
map.addLayer(grid);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|