0d1eae32be
Fix #5373. - Remove references to removed file "../../build/deps.js" - Update leaflet-include.js to point to "../dist/leaflet-src.js" - Update watch to use the same destination file as rollup (dist/leaflet-src.js) - Define getRandomLatLng where used
43 lines
1.3 KiB
HTML
43 lines
1.3 KiB
HTML
<html>
|
|
<head>
|
|
<title>Test for preservation of Icon DOM element</title>
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script src="../leaflet-include.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="map" style="width: 600px; height: 600px; border: 1px solid #ccc"></div>
|
|
|
|
<script>
|
|
|
|
var blueIcon = new L.Icon({iconUrl: 'http://www.webatlas.no/webatlasapi/v/071009/media/interface/default/markers/flag_blue.gif'});
|
|
var redIcon = new L.Icon({iconUrl: 'http://www.webatlas.no/webatlasapi/v/071009/media/interface/default/markers/flag_red.gif'});
|
|
|
|
var map = L.map('map').setView( [50, 50], 10);
|
|
|
|
var marker = L.marker([50, 50], {icon: blueIcon, draggable: true});
|
|
|
|
marker.on('dragstart', function () {
|
|
console.log('dragstart');
|
|
marker.setIcon(redIcon);
|
|
//This is the previous workaround:
|
|
//var iconElem = L.DomUtil.get(marker._icon);
|
|
//iconElem.src = 'http://www.webatlas.no/webatlasapi/v/071009/media/interface/default/markers/flag_red.gif';
|
|
});
|
|
|
|
marker.on('dragend', function () {
|
|
console.log('dragend');
|
|
marker.setIcon(blueIcon);
|
|
//This is the previous workaround:
|
|
//var iconElem = L.DomUtil.get(marker._icon);
|
|
//iconElem.src = 'http://www.webatlas.no/webatlasapi/v/071009/media/interface/default/markers/flag_blue.gif';
|
|
|
|
});
|
|
|
|
marker.addTo(map);
|
|
</script>
|
|
</body>
|
|
</html>
|