Skip to content

Commit 4ea6d23

Browse files
committed
Unregister ResizeObserver for map container
This unregisters the ResizeObserver for the map's container, when the map is unmounted/destroyed.
1 parent 537e3d4 commit 4ea6d23

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/components/ol/Map.vue

+6
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default {
7878
me.map.updateSize();
7979
});
8080
resizeObserver.observe(container);
81+
this.resizeObserver = resizeObserver;
8182
8283
// add tabIndex attribute to the map's container, so it gets focusable.
8384
// Otherwise the OL keyboard navigation won't work, see keyboardEventTarget
@@ -98,6 +99,11 @@ export default {
9899
}, 200);
99100
},
100101
destroyed () {
102+
// unregister resizing of the map
103+
if (this.resizeObserver) {
104+
this.resizeObserver.disconnect();
105+
}
106+
101107
// Send the event 'ol-map-unmounted' with the OL map as payload
102108
WguEventBus.$emit('ol-map-unmounted', this.map);
103109

0 commit comments

Comments
 (0)