facilmap/leaflet/icontest.html

46 wiersze
1.4 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 src="https://unpkg.com/leaflet"></script>
<!-- <script src="https://unpkg.com/socket.io-client/dist/socket.io.js"></script> -->
<script type="text/javascript" src="dist/facilmap-leaflet.full.js"></script>
<script type="text/javascript">
function createIcons(id, createIcon) {
const el = document.createElement("div");
el.id = id;
document.body.appendChild(el);
for (const icon of ["", "O", "g", "j", "a", "*", ...L.FacilMap.symbolList]) {
const span = document.createElement('span');
span.title = icon;
span.innerHTML = createIcon(icon);
el.appendChild(span);
}
}
createIcons("icons", (icon) => L.FacilMap.getSymbolHtml("#000000", 50, icon));
for (const shape of ["drop", "rectangle-marker", "circle", "rectangle", "diamond", "pentagon", "hexagon", "triangle", "triangle-down", "star"]) {
createIcons(`icons-${shape}`, (icon) => L.FacilMap.getMarkerHtml("#ccffcc", 50, icon, shape));
createIcons(`icons-${shape}-highlight`, (icon) => L.FacilMap.getMarkerHtml("#ccffcc", 50, icon, shape, true));
}
</script>
</body>
</html>