mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-12-08 21:26:14 +00:00
Signed-off-by: Jon Koops <jonkoops@gmail.com> Co-authored-by: Florian Bischof <design.falke@gmail.com>
68 lines
1.9 KiB
HTML
68 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Leaflet debug page - Scaled</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>
|
|
<style>
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
#wrapper {
|
|
transform: scale(.5, .25); /* scaleX0 = .5 ; scaleY0 = .25 */
|
|
transform-origin: 0 0;
|
|
padding: 40px 100px; /* displayed padding-top = scaleY0 * 40px = 10px ; displayed padding-left = scaleX0 * 100px = 50px */
|
|
}
|
|
|
|
#map {
|
|
width: 400px;
|
|
height: 300px;
|
|
transform: scale(3, 8); /* scaleX = .5 * 3 = 1.5 ; scaleY = .25 * 8 = 2 */
|
|
transform-origin: 0 0;
|
|
border-width: 30px 70px; /* displayed border-top-width = scaleY * 30px = 60px ; displayed border-left-width = scaleX * 70px = 105px */
|
|
}
|
|
</style>
|
|
<div id="wrapper">
|
|
<div id="map"></div>
|
|
</div>
|
|
<script type="module">
|
|
import {TileLayer, Map, Marker, DomEvent} from 'leaflet';
|
|
|
|
const osmUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
const osmAttrib = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
|
const osm = new TileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
|
|
|
const map = new Map('map')
|
|
.setView([50.5, 30.51], 15)
|
|
.addLayer(osm);
|
|
|
|
const mapContainer = map.getContainer();
|
|
|
|
const marker = new Marker([50.5, 30.51], {
|
|
draggable: true
|
|
}).addTo(map);
|
|
|
|
map.on('drag', (event) => {
|
|
console.log('map:', DomEvent.getMousePosition(event.originalEvent, mapContainer));
|
|
});
|
|
|
|
marker.on('drag', (event) => {
|
|
console.log('marker:', DomEvent.getMousePosition(event.originalEvent, mapContainer));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|