Skip to content

Commit

Permalink
Only create pane for layer group if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
JLyne committed Dec 23, 2020
1 parent 05bf3e8 commit a5ff836
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/leaflet/layer/DynmapLayerGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default class DynmapLayerGroup extends LayerGroup {
_zoomLimitedLayers: Set<Layer>; //Layers which are zoom limited and should be checked on zoom
_layers: any;
_markerPane?: HTMLElement;
_vectorPane?: HTMLElement;

_zoomEndCallback = () => this._updateLayerVisibility();

Expand All @@ -47,7 +46,7 @@ export default class DynmapLayerGroup extends LayerGroup {
map.on('zoomend', this._zoomEndCallback, this);

this._map = map;
this._markerPane = map.createPane(`${this.options.id}-markers`);
this._markerPane = map.getPane(`${this.options.id}-markers`) || map.createPane(`${this.options.id}-markers`);

this._markerPane.classList.toggle('leaflet-pane--show-labels', this.options.showLabels);

Expand Down

0 comments on commit a5ff836

Please sign in to comment.