Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added visibility setting for layers instead of adding and removing la… #1005

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/layer/decorate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ function show() {
// Add layer to map
this.mapview.Map.addLayer(this.L);
} catch {
// Will catch assertation error when layer is already added.
// If layer is already added, set its visibility to true
this.L.setVisible(true);
}

// Reload layer data if available.
Expand All @@ -247,7 +248,7 @@ function hide() {
this.display = false;

// Remove OL layer from mapview.
this.mapview.Map.removeLayer(this.L);
this.L.setVisible(false);

// Remove layer attribution from mapview attribution.
this.mapview.attribution?.check();
Expand Down