Skip to content

Commit

Permalink
Merge branch 'main' into decaporg#7197
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjagodic committed Jun 26, 2024
2 parents 082a8a1 + 041e34e commit 21d9ed0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/decap-cms-widget-map/src/withMapControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function withMapControl({ getFormat, getMap } = {}) {
constructor(props) {
super(props);
this.mapContainer = React.createRef();
this.resizeObserver = null;
}

componentDidMount() {
Expand All @@ -69,6 +70,18 @@ export default function withMapControl({ getFormat, getMap } = {}) {
featuresSource.clear();
onChange(format.writeGeometry(feature.getGeometry(), writeOptions));
});

this.resizeObserver = new ResizeObserver(() => {
map.updateSize();
});

this.resizeObserver.observe(target);
}

componentWillUnmount() {
if (this.resizeObserver) {
this.resizeObserver.disconnect();
}
}

render() {
Expand Down

0 comments on commit 21d9ed0

Please sign in to comment.