/
githubmirror
/
Leaflet
Обзор
Документация
Войти
/
githubmirror
/
Leaflet
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
debug/tests/popup-context-menu-clicks.html
57 строк
1 KB
Jon Koops
Drop UMD and make ESM the default entrypoint (#8826)
17 мар 2025, 17:59
Не верифицирован
17 мар 2025, 17:59
7ac9875
Код
Авторство
О чём код?
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Leaflet debug page - Popup Context Menu Clicks</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" /> <script type="importmap"> { "imports": { "leaflet": "../../dist/leaflet-src.js" } } </script> </head> <body> <div id="map"></div> <button id="populate">Populate with 10 markers</button> <script type="module"> import {Map, TileLayer, GeoJSON, Marker} from 'leaflet'; const map = new Map('map').setView([36.9, -95.4], 5); map.on('contextmenu', () => { alert('The map has been right-clicked'); }); new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); const exampleGeoJSON = { type: 'Polygon', coordinates: [ [ [-90.0, 35.0], [-90.0, 45.0], [-100.0, 45.0], [-100.0, 35.0], ], ], }; new GeoJSON(exampleGeoJSON, { onEachFeature(feature, layer) { layer.on('contextmenu', () => { alert('The GeoJSON layer has been clicked'); }); }, }).addTo(map); const marker = new Marker([36, -95]).addTo(map); marker .bindPopup('Right-click me <br> to test contextmenu <br> event capture') .openPopup(); </script> </body> </html>