Skip to content

Commit

Permalink
Don't remove the source when the map is removed.
Browse files Browse the repository at this point in the history
The source has already be removed by maplibre.
  • Loading branch information
francois2metz committed May 21, 2024
1 parent 66e49fd commit 4928b07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ export default class IndoorEqual {
/**
* Remove any layers, source and listeners and controls
*/
remove() {
this.source.remove();
remove(fromRemoveEvent) {
if (!fromRemoveEvent) {
this.source.remove();
}
this._updateLevelsDebounce.clear();
this.map.off('load', this._updateLevelsDebounce);
this.map.off('data', this._updateLevelsDebounce);
Expand Down Expand Up @@ -247,7 +249,7 @@ export default class IndoorEqual {
this.map.on('data', this._updateLevelsDebounce);
this.map.on('move', this._updateLevelsDebounce);
this.map.on('remove', () => {
this.remove();
this.remove(true);
});
}

Expand Down

0 comments on commit 4928b07

Please sign in to comment.