From 236828bea81778c053740a8988e1884627fcabd3 Mon Sep 17 00:00:00 2001 From: Christian Mayer Date: Thu, 6 Jun 2024 10:09:11 +0200 Subject: [PATCH] Unregister ResizeObserver for map container This unregisters the ResizeObserver for the map's container, when the map is unmounted/destroyed. --- src/components/ol/Map.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/ol/Map.vue b/src/components/ol/Map.vue index 86dc6e5e..a2d66bb1 100644 --- a/src/components/ol/Map.vue +++ b/src/components/ol/Map.vue @@ -78,6 +78,7 @@ export default { me.map.updateSize(); }); resizeObserver.observe(container); + this.resizeObserver = resizeObserver; // add tabIndex attribute to the map's container, so it gets focusable. // Otherwise the OL keyboard navigation won't work, see keyboardEventTarget @@ -98,6 +99,9 @@ export default { }, 200); }, destroyed () { + // unregister resizing of the map + this.resizeObserver.disconnect(); + // Send the event 'ol-map-unmounted' with the OL map as payload WguEventBus.$emit('ol-map-unmounted', this.map);