diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 3323d15b56..1a32c7d41c 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -61,7 +61,7 @@ "leaflet": "1.9.4", "leaflet-polylinedecorator": "1.6.0", "leaflet-providers": "2.0.0", - "leaflet.gridlayer.googlemutant": "0.14.1", + "leaflet.gridlayer.googlemutant": "0.15.0", "leaflet.markercluster": "1.5.3", "libphonenumber-js": "^1.11.15", "maplibre-gl": "^5.2.0", diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet/leaflet-tb.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet/leaflet-tb.ts index 95b8932db0..79e2f11ce6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet/leaflet-tb.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet/leaflet-tb.ts @@ -772,6 +772,9 @@ class MapLibreGLLayer extends L.Layer implements TB.MapLibreGL.MapLibreGLLayer { attributionControl: false }); this._glMap = new MapLibreGLMap(options); + this._glMap.once('load', () => { + this.fire('load'); + }); this._glMap.setMaxBounds(null); this._transformGL(this._glMap); this._actualCanvas = this._glMap._canvas; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-layer.ts index b40abd1d66..b3a41ec2f3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-layer.ts @@ -116,8 +116,22 @@ export abstract class TbMapLayer { map((referenceLayer) => { if (referenceLayer) { const layer = L.featureGroup(); + let baseLayerLoaded = false; + let referenceLayerLoaded = false; baseLayer.addTo(layer); referenceLayer.addTo(layer); + baseLayer.once('load', () => { + baseLayerLoaded = true; + if (referenceLayerLoaded) { + layer.fire('load'); + } + }); + referenceLayer.once('load', () => { + referenceLayerLoaded = true; + if (baseLayerLoaded) { + layer.fire('load'); + } + }); return { layer, attribution: !!baseLayer.getAttribution() || !!referenceLayer.getAttribution() diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index b3cc13904a..04e0c4f77a 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -6667,10 +6667,10 @@ leaflet-rotatedmarker@^0.2.0: resolved "https://registry.yarnpkg.com/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz#4467f49f98d1bfd56959bd9c6705203dd2601277" integrity sha512-yc97gxLXwbZa+Gk9VCcqI0CkvIBC9oNTTjFsHqq4EQvANrvaboib4UdeQLyTnEqDpaXHCqzwwVIDHtvz2mUiDg== -leaflet.gridlayer.googlemutant@0.14.1: - version "0.14.1" - resolved "https://registry.yarnpkg.com/leaflet.gridlayer.googlemutant/-/leaflet.gridlayer.googlemutant-0.14.1.tgz#c282209aa1a39eb2f87d8aaa4e9894181c9e20a0" - integrity sha512-/OYxEjmgxO1U1KOhTzg+m8c0b95J0943LU8DXQmdJu/x2f+1Ur78rvEPO2QCS0cmwZ3m6FvE5I3zXnBzJNWRCA== +leaflet.gridlayer.googlemutant@0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/leaflet.gridlayer.googlemutant/-/leaflet.gridlayer.googlemutant-0.15.0.tgz#7a32d949578695b8aa8fa5fd11b40bd7a6ce6c23" + integrity sha512-kA5jCOBhCPigyue6YpZMhXMVYA1hM2pDIaJ6u0wSSiSZ2TQ4kZfKuhwkIexcadJfs0BP4FyhZIDZC7hmTlvjOA== leaflet.markercluster@1.5.3: version "1.5.3"