Skip to content

Commit

Permalink
Merge pull request #477 from cmv/feature/layerControl-hide-sublayers-…
Browse files Browse the repository at this point in the history
…and-folders

Added new `layerIds` option to layerControl configuration.
  • Loading branch information
DavidSpriggs committed Nov 23, 2015
2 parents bb76369 + 5dacdd2 commit fc226dd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@ define([
id: 'louisvillePubSafety',
opacity: 1.0,
visible: true,
imageParameters: buildImageParameters()
imageParameters: buildImageParameters({
layerIds: [0, 2, 4, 5, 8, 10, 12, 21],
layerOption: 'show'
})
},
identifyLayerInfos: {
layerIds: [2, 4, 5, 8, 12, 21]
},
layerControlLayerInfos: {
layerIds: [0, 2, 4, 5, 8, 9, 10, 12, 21]
},
legendLayerInfos: {
layerInfo: {
hideLayers: [21]
Expand Down
4 changes: 4 additions & 0 deletions viewer/js/gis/dijit/LayerControl/controls/_DynamicFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ define([
_expandClickHandler: null,
postCreate: function () {
this.inherited(arguments);
// Should the control be visible or hidden?
if (this.control.controlOptions.layerIds && this.control.controlOptions.layerIds.indexOf(this.sublayerInfo.id) < 0) {
domClass.add(this.domNode, 'layerControlHidden');
}
var checkNode = this.checkNode;
domAttr.set(checkNode, 'data-sublayer-id', this.sublayerInfo.id);
domClass.add(checkNode, this.control.layer.id + '-layerControlSublayerCheck');
Expand Down
4 changes: 4 additions & 0 deletions viewer/js/gis/dijit/LayerControl/controls/_DynamicSublayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ define([
_expandClickHandler: null,
postCreate: function () {
this.inherited(arguments);
// Should the control be visible or hidden?
if (this.control.controlOptions.layerIds && this.control.controlOptions.layerIds.indexOf(this.sublayerInfo.id) < 0) {
domClass.add(this.domNode, 'layerControlHidden');
}
var checkNode = this.checkNode;
domAttr.set(checkNode, 'data-sublayer-id', this.sublayerInfo.id);
domClass.add(checkNode, this.control.layer.id + '-layerControlSublayerCheck');
Expand Down
7 changes: 7 additions & 0 deletions viewer/js/gis/dijit/LayerControl/css/LayerControl.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
text-align: center;
}

.layerControlDijit .layerControlHidden {
display: none;
}
.layerControlDijit .layerControlVisible {
display: block;
}

.layerControlDijit .layerControlIndent {
padding-left: 22px;
}
Expand Down

0 comments on commit fc226dd

Please sign in to comment.