diff --git a/src/components/layers/LayerList.jsx b/src/components/layers/LayerList.jsx index 8853dc2..c30c647 100644 --- a/src/components/layers/LayerList.jsx +++ b/src/components/layers/LayerList.jsx @@ -50,6 +50,7 @@ class LayerListContainer extends React.Component { super(props) this.state = { collapsedGroups: {}, + areAllGroupsExpanded: false, isOpen: { add: false, } @@ -95,6 +96,31 @@ class LayerListContainer extends React.Component { }) } + toggleLayers() { + let idx=0 + + let newGroups=[] + + this.groupedLayers().forEach(layers => { + const groupPrefix = layerPrefix(layers[0].id) + const lookupKey = [groupPrefix, idx].join('-') + + + if (layers.length > 1) { + newGroups[lookupKey] = this.state.areAllGroupsExpanded + } + + layers.forEach((layer) => { + idx += 1 + }) + }); + + this.setState({ + collapsedGroups: newGroups, + areAllGroupsExpanded: !this.state.areAllGroupsExpanded + }) + } + groupedLayers() { const groups = [] for (let i = 0; i < this.props.layers.length; i++) { @@ -178,11 +204,24 @@ class LayerListContainer extends React.Component {
Layers - +
+
+ + {this.state.areAllGroupsExpanded === true ? "Collapse" : "Expand"} + +
+
+
+
+ + Add Layer + +
+