diff --git a/src/controls/legend.js b/src/controls/legend.js index 1abcf8dbf..9b5241176 100644 --- a/src/controls/legend.js +++ b/src/controls/legend.js @@ -555,6 +555,7 @@ const Legend = function Legend(options = {}) { }, getuseGroupIndication() { return useGroupIndication; }, getOverlaysCollapse() { return overlaysCmp.overlaysCollapse; }, + getOverlays() { return overlaysCmp; }, setVisibleLayersViewActive, addButtonToTools(button, buttonGroup) { if (buttonGroup === 'addLayerButton') { diff --git a/src/controls/legend/group.js b/src/controls/legend/group.js index e693435a0..f3760e926 100644 --- a/src/controls/legend/group.js +++ b/src/controls/legend/group.js @@ -1,5 +1,7 @@ import { Component, Button, Collapse, CollapseHeader, dom } from '../../ui'; import GroupList from './grouplist'; +import createMoreInfoButton from './moreinfobutton'; +import LayerProperties from './overlayproperties'; /** * The Group component can be a group or a subgroup, @@ -16,13 +18,17 @@ const Group = function Group(viewer, options = {}) { name, parent, abstract, + showAbstractInLegend = false, position = 'top', type = 'group', autoExpand = true, exclusive = false, toggleAll = true, draggable = false, - zIndexStart = 0.1 + zIndexStart = 0.1, + opacityControl = false, + zoomToExtent = false, + description } = options; const stateCls = { @@ -37,9 +43,11 @@ const Group = function Group(viewer, options = {}) { let selectedItem; const listCls = type === 'grouplayer' ? 'divider-start padding-left padding-top-small' : ''; - const groupList = GroupList({ viewer, cls: listCls, abstract }); + const groupList = GroupList({ viewer, cls: listCls, abstract, showAbstractInLegend }); visibleState = groupList.getVisible(); + const thisGroup = viewer.getGroup(name); + const getEl = () => groupEl; const getCheckIcon = (visible) => { @@ -70,6 +78,9 @@ const Group = function Group(viewer, options = {}) { } }) : false; + const moreInfoButton = (opacityControl || zoomToExtent || description || (abstract && !showAbstractInLegend)) ? createMoreInfoButton({ viewer, + group: thisGroup }) : false; + const SubGroupHeader = function SubGroupHeader() { const expandButton = Button({ cls: 'icon-small compact round', @@ -86,6 +97,9 @@ const Group = function Group(viewer, options = {}) { if (tickButton) { this.addComponent(tickButton); } + if (moreInfoButton) { + this.addComponent(moreInfoButton); + } }, onRender() { this.dispatch('render'); @@ -99,12 +113,14 @@ const Group = function Group(viewer, options = {}) { }); }, render() { - return `