facilmap/leaflet/icontest.html

46 wiersze
1.2 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>facilmap-leaflet Example</title>
<style>
span {
display: inline-block;
height: 50px;
background: #faa;
margin: 5px;
}
#icons span {
width: 50px;
}
</style>
</head>
<body>
<script type="module">
import * as FacilMap from "facilmap-leaflet";
function createIcons(id, createIcon) {
const el = document.createElement("div");
el.id = id;
document.body.appendChild(el);
for (const icon of ["", "O", "g", "j", "a", "*", ...FacilMap.iconList]) {
const span = document.createElement('span');
span.title = icon;
createIcon(icon).then((html) => {
span.innerHTML = html;
});
el.appendChild(span);
}
}
createIcons("icons", (icon) => FacilMap.getIconHtml("#000000", 50, icon));
for (const shape of ["drop", "rectangle-marker", "circle", "rectangle", "diamond", "pentagon", "hexagon", "triangle", "triangle-down", "star"]) {
createIcons(`icons-${shape}`, (icon) => FacilMap.getMarkerHtml("#ccffcc", 50, icon, shape));
createIcons(`icons-${shape}-highlight`, (icon) => FacilMap.getMarkerHtml("#ccffcc", 50, icon, shape, true));
}
</script>
</body>
</html>