feat(geomap): enhance icon building to include color class

This commit is contained in:
McSido 2025-02-19 22:52:38 +01:00
parent 6b5d905ebe
commit 04a6175630

View File

@ -222,7 +222,7 @@ export default class GeoMapTypeWidget extends TypeWidget {
const [ lat, lng ] = latLng.split(",", 2).map((el) => parseFloat(el));
const L = this.L;
const icon = this.#buildIcon(note.getIcon(), note.title);
const icon = this.#buildIcon(note.getIcon(), note.getColorClass(), note.title);
const marker = L.marker(L.latLng(lat, lng), {
icon,
@ -257,12 +257,12 @@ export default class GeoMapTypeWidget extends TypeWidget {
this.currentMarkerData[note.noteId] = marker;
}
#buildIcon(bxIconClass: string, title: string) {
#buildIcon(bxIconClass: string, colorClass: string, title: string) {
return this.L.divIcon({
html: `\
<img class="icon" src="${asset_path}/node_modules/leaflet/dist/images/marker-icon.png" />
<img class="icon-shadow" src="${asset_path}/node_modules/leaflet/dist/images/marker-shadow.png" />
<span class="bx ${bxIconClass}"></span>
<span class="bx ${bxIconClass} ${colorClass}"></span>
<span class="title-label">${title}</span>`,
iconSize: [ 25, 41 ],
iconAnchor: [ 12, 41 ]