From 545e1992326710d654fd9a48f8808c39a9c3dc45 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 4 Apr 2025 14:19:44 +0300 Subject: [PATCH] fix(geomap): map cut off at first start --- src/public/app/widgets/type_widgets/geo_map.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index 5d004632f..e858694dc 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -124,10 +124,10 @@ export default class GeoMapTypeWidget extends TypeWidget { } doRender() { + super.doRender(); + this.$widget = $(TPL); this.$widget.append(this.geoMapWidget.render()); - - super.doRender(); } async #onMapInitialized(L: Leaflet) { @@ -142,6 +142,11 @@ export default class GeoMapTypeWidget extends TypeWidget { // Restore markers. await this.#reloadMarkers(); + // This fixes an issue with the map appearing cut off at the beginning, due to the container not being properly attached + setTimeout(() => { + map.invalidateSize(); + }, 100); + const updateFn = () => this.spacedUpdate.scheduleUpdate(); map.on("moveend", updateFn); map.on("zoomend", updateFn);