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 new layerIds option to layerControl configuration. #477

Merged
Merged
Show file tree
Hide file tree
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
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a potential issue here with array.indexOf(). It is only supported in IE 9+ this breaks in IE 8 and below. I will approve for now but lets look at using dojo/array.indexOf() that will abstract this issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidSpriggs you are correct and I will add the fix. I believe I saw indexOf used this way in some other widget. I'll track down that instance as well.

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