From 04a6175630ecca389390da4f915ac6499f1ddadf Mon Sep 17 00:00:00 2001 From: McSido Date: Wed, 19 Feb 2025 22:52:38 +0100 Subject: [PATCH 1/2] feat(geomap): enhance icon building to include color class --- src/public/app/widgets/type_widgets/geo_map.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index 1c1a72e35..4579ab730 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -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: `\ - + ${title}`, iconSize: [ 25, 41 ], iconAnchor: [ 12, 41 ] From 57b303555963f123519a4b5f6d96217cbd3c7cab Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 20 Feb 2025 21:39:35 +0200 Subject: [PATCH 2/2] feat(geomap): refresh map if color attribute is changed --- src/public/app/widgets/type_widgets/geo_map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index 4579ab730..32f689e6f 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -361,7 +361,7 @@ export default class GeoMapTypeWidget extends TypeWidget { // If any of note has its location attribute changed. // TODO: Should probably filter by parent here as well. const attributeRows = loadResults.getAttributeRows(); - if (attributeRows.find((at) => at.name === LOCATION_ATTRIBUTE)) { + if (attributeRows.find((at) => [ LOCATION_ATTRIBUTE, "color" ].includes(at.name ?? ""))) { this.#reloadMarkers(); } }