Skip to content

Commit 236828b

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 236828b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

+4
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,9 @@ export default {
9899
}, 200);
99100
},
100101
destroyed () {
102+
// unregister resizing of the map
103+
this.resizeObserver.disconnect();
104+
101105
// Send the event 'ol-map-unmounted' with the OL map as payload
102106
WguEventBus.$emit('ol-map-unmounted', this.map);
103107

0 commit comments

Comments
 (0)