Skip to content

Commit

Permalink
Hide the legend if the layer is not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Jul 15, 2019
1 parent 7e29776 commit 2dfd494
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 8 additions & 2 deletions contribs/gmf/src/layertree/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,14 @@
border: 0.06rem solid $main-bg-color;
background-color: lighten($main-bg-color, 8%);

.off {
opacity: 0.5;
display: none;
&.show {
// legend is displayed
display: block;
&.off {
// legend is displayed but the layer is not visible
display: none;
}
}

a {
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/layertree/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

<div
ng-if="::!layertreeCtrl.isRoot && gmfLayertreeCtrl.getLegendsObject(layertreeCtrl) && layertreeCtrl.node.metadata.legend" id="gmf-layertree-node-{{::layertreeCtrl.uid}}-legend"
class="collapse gmf-layertree-legend"
class="gmf-layertree-legend"
ng-class="[gmfLayertreeCtrl.getNodeState(layertreeCtrl), layertreeCtrl.node.metadata.isLegendExpanded ? 'show' : '']">

<a
Expand Down
7 changes: 4 additions & 3 deletions contribs/gmf/src/layertree/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,10 @@ Controller.prototype.zoomToResolution = function(treeCtrl) {
* @param {string} legendNodeId The DOM node legend id to toggle
*/
Controller.prototype.toggleNodeLegend = function(legendNodeId) {
$(legendNodeId).toggle({
toggle: true
});
const div = document.querySelector(legendNodeId);
if (div) {
div.classList.toggle('show');
}
};


Expand Down

0 comments on commit 2dfd494

Please sign in to comment.