mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-25 01:32:21 +00:00
Convert controls debug page to ESM (#8834)
This commit is contained in:
@ -1,35 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Leaflet debug page</title>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>Leaflet debug page - Control</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 src="../../dist/leaflet-src.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="map"></div>
|
||||
<script type="module">
|
||||
import {TileLayer, Map, Marker, LatLng, Control} from '../../dist/leaflet-src.esm.js';
|
||||
|
||||
<script>
|
||||
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 osm2 = new TileLayer(osmUrl, {attribution: 'Hello world'});
|
||||
|
||||
var osmUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmAttrib = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
|
||||
osm2 = new L.TileLayer(osmUrl, {attribution: 'Hello world'});
|
||||
const map = new Map('map').addLayer(osm).setView(new LatLng(50.5, 30.512), 15);
|
||||
|
||||
var map = new L.Map('map').addLayer(osm).setView(new L.LatLng(50.5, 30.512), 15);
|
||||
|
||||
var marker = new L.Marker(new L.LatLng(50.5, 30.505));
|
||||
const marker = new Marker(new LatLng(50.5, 30.505));
|
||||
map.addLayer(marker);
|
||||
marker.bindPopup("Leaflet is designed with simplicity, performance and usability in mind. It works efficiently across all major desktop and mobile platforms out of the box, taking advantage of HTML5 and CSS3 on modern browsers while still being accessible on older ones.").openPopup();
|
||||
marker.bindPopup('Leaflet is designed with simplicity, performance and usability in mind. It works efficiently across all major desktop and mobile platforms out of the box, taking advantage of HTML5 and CSS3 on modern browsers while still being accessible on older ones.').openPopup();
|
||||
|
||||
var marker2 = new L.Marker(new L.LatLng(50.502, 30.515));
|
||||
const marker2 = new Marker(new LatLng(50.502, 30.515));
|
||||
map.addLayer(marker2);
|
||||
|
||||
var layersControl = new L.Control.Layers({
|
||||
const layersControl = new Control.Layers({
|
||||
'OSM': osm,
|
||||
'OSM2': osm2
|
||||
}, {
|
||||
@ -38,8 +35,7 @@
|
||||
});
|
||||
|
||||
map.addControl(layersControl);
|
||||
map.addControl(new L.Control.Scale());
|
||||
|
||||
map.addControl(new Control.Scale());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user