Leaflet/debug/tests/dragging-cursors.html
Jon Koops 7ac98758d4
Drop UMD and make ESM the default entrypoint (#8826)
Signed-off-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: Florian Bischof <design.falke@gmail.com>
2025-03-17 15:59:00 +01:00

54 lines
1.5 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Leaflet debug page - Dragging Cursors</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>
This page tests if the cursors for dragging the map and the markers behave as expected. The left marker is draggable, the right one is not.
<hr>
<div>Map dragging enabled:</div>
<div id="map1" style="height: 300px;width: 400px; float:left;"></div>
<div style="clear:both"></div>
<div>Map dragging disabled:</div>
<div id="map2" style="height: 300px;width: 400px; float:left;"></div>
<script type="module">
import {TileLayer, Marker, Map, LatLng} from 'leaflet';
function addLayerAndMarkers(map) {
new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18
}).addTo(map);
new Marker([20, -120.3], {draggable: true}).addTo(map);
new Marker([50.5, 30.5], {draggable: false}).addTo(map);
}
const map1 = new Map('map1', {
center : new LatLng(0, -30),
zoom : 0,
dragging : true,
});
const map2 = new Map('map2', {
center : new LatLng(0, -30),
zoom : 0,
dragging : false,
});
addLayerAndMarkers(map1);
addLayerAndMarkers(map2);
</script>
</body>
</html>