Skip to content

Commit

Permalink
fix(POI Map): Reset bbox to initial state when interactivity is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSzmarowski committed Oct 18, 2023
1 parent fb154ed commit cf7904c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/visualizations/src/components/MapPoi/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export default class MapPOI {
/** An array of functions to be executed when the map is ready. */
private queuedFunctions: Array<MapFunction> = [];

/** Memoized bbox set in map instance to enable bbox reset */
private memoizedBbox?: BBox;

/** To queue functions that depend on map readiness. Will be executed when the card is ready. */
private queue(fn: MapFunction) {
if (this.isReady && this.map) fn(this.map);
Expand Down Expand Up @@ -302,6 +305,7 @@ export default class MapPOI {
animate: false,
padding: 40,
});
this.memoizedBbox = bbox;
});
}

Expand Down Expand Up @@ -339,6 +343,8 @@ export default class MapPOI {
if (hasControl) {
map.removeControl(this.navigationControl);
}
// Reset bbox to its initial state
this.setBbox(this.memoizedBbox);
}
if (interaction === 'enable') {
if (!hasControl) {
Expand Down

0 comments on commit cf7904c

Please sign in to comment.