UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

78 lines (61 loc) 1.91 kB
<!DOCTYPE html> <html> <head> <title>Leaflet debug page</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- <link rel="stylesheet" href="../css/screen.css" /> --> <link rel="stylesheet" href="../css/mobile.css" /> <script type="text/javascript" src="../../build/deps.js"></script> <script src="../leaflet-include.js"></script> <style> #map { /* margin: 256px; */ /* width: auto; */ overflow: visible; z-index:0; } </style> </head> <body> <!-- <div style='z-index: 1000'> 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> <button onclick="map.setBearing(0);" > 0</button> <button onclick="map.setBearing(15);">15</button> <button onclick="map.setBearing(30);">30</button> <button onclick="map.setBearing(45);">45</button> <button onclick="map.setBearing(60);">60</button> <button onclick="map.setBearing(75);">75</button> <button onclick="map.setBearing(90);">90</button> </div> </div>--> <!-- <div style='overflow:hidden;'> --> <div id="map" class="map"></div> <!-- </div> --> <script type="text/javascript"> var mapopts = { center: [35, -122], zoom : 5.7 }; var map = L.map('map', mapopts); var grid = L.gridLayer({ attribution: 'Grid Layer', tileSize: 128 }); 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>