/
githubmirror
/
Leaflet
Обзор
Документация
Войти
/
githubmirror
/
Leaflet
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
debug/tests/tile-bounds.html
66 строк
2 KB
Simon Legner
Rename `Map` to `LeafletMap` and keep `Map` as alias (#9892)
11 ноя 2025, 21:28
Не верифицирован
11 ноя 2025, 21:28
2e9b617
Код
Авторство
О чём код?
<!doctype html> <html> <head> <meta charset="utf-8" /> <title>Leaflet debug page - Tile Bounds</title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" /> <link rel="stylesheet" href="../../dist/leaflet.css" /> <link rel="stylesheet" href="../css/screen.css" /> <style> #map { margin: 256px; width: auto; overflow: visible } </style> <script type="importmap"> { "imports": { "leaflet": "../../dist/leaflet-src.js" } } </script> </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 id="zoomIn" type="button"> Zoom + 0.1 </button> <button id="zoomOut" type="button"> Zoom - 0.1 </button> <div id="map"></div> <script type="module"> import {LeafletMap, GridLayer, Point} from 'leaflet'; const map = new LeafletMap('map', { center: [35, -122], zoom: 5.7, zoomSnap: 0.1 }); const zoomInBtn = document.getElementById('zoomIn'); const zoomOutBtn = document.getElementById('zoomOut'); zoomInBtn.addEventListener('click', () => map.zoomIn(0.1)); zoomOutBtn.addEventListener('click', () => map.zoomOut(0.1)); const grid = new GridLayer({ attribution: 'Grid Layer', tileSize: new Point(150, 80) }); grid.createTile = (coords, done) => { const 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(() => { done(null, tile); }, 0); return tile; }; map.addLayer(grid); </script> </body> </html>