Skip to content

Commit

Permalink
Migrate home toolbar button to be a reset button that also resets lay…
Browse files Browse the repository at this point in the history
…er visibility
  • Loading branch information
ianguerin committed May 1, 2024
1 parent 5d616f9 commit c79cd42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/js/models/maps/assets/MapAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ define([
}
}

this.set("originalVisibility", this.get("visible"));
this.setListeners();
} catch (e) {
console.log("Error initializing a MapAsset model", e);
Expand Down Expand Up @@ -393,7 +394,6 @@ define([
* @since 2.27.0
*/
handleError: function () {
this.set("originalVisibility", this.get("visible"));
this.set("visible", false);
this.stopListening(this, "change:visible");
},
Expand Down
9 changes: 7 additions & 2 deletions src/js/views/maps/ToolbarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ define(
},
},
{
label: 'Home',
icon: 'home',
label: 'Reset',
icon: 'rotate-left',
action: function (view, model) {
model.flyHome();

// Reset the visibility of all layers.
for (const layer of model.getAllLayers()) {
layer.set("visible", layer.get('originalVisibility'));
}
},
isVisible(model) {
return model.get("showHomeButton");
Expand Down

0 comments on commit c79cd42

Please sign in to comment.