mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-30 05:55:32 +01:00
Collapse layer groups by default #66
This commit is contained in:
parent
3f262885ca
commit
e5fbe3b74a
1 changed files with 3 additions and 3 deletions
|
@ -115,7 +115,7 @@ class LayerListContainer extends React.Component {
|
||||||
if(lookupKey in this.state.collapsedGroups) {
|
if(lookupKey in this.state.collapsedGroups) {
|
||||||
newGroups[lookupKey] = !this.state.collapsedGroups[lookupKey]
|
newGroups[lookupKey] = !this.state.collapsedGroups[lookupKey]
|
||||||
} else {
|
} else {
|
||||||
newGroups[lookupKey] = true
|
newGroups[lookupKey] = false
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
collapsedGroups: newGroups
|
collapsedGroups: newGroups
|
||||||
|
@ -124,7 +124,7 @@ class LayerListContainer extends React.Component {
|
||||||
|
|
||||||
isCollapsed(groupPrefix, idx) {
|
isCollapsed(groupPrefix, idx) {
|
||||||
const collapsed = this.state.collapsedGroups[[groupPrefix, idx].join('-')]
|
const collapsed = this.state.collapsedGroups[[groupPrefix, idx].join('-')]
|
||||||
return collapsed === undefined ? false : collapsed
|
return collapsed === undefined ? true : collapsed
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -147,7 +147,7 @@ class LayerListContainer extends React.Component {
|
||||||
const groupIdx = findClosestCommonPrefix(this.props.layers, idx)
|
const groupIdx = findClosestCommonPrefix(this.props.layers, idx)
|
||||||
const listItem = <LayerListItem
|
const listItem = <LayerListItem
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'maputnik-layer-list-item-collapsed': this.isCollapsed(groupPrefix, groupIdx),
|
'maputnik-layer-list-item-collapsed': layers.length > 1 && this.isCollapsed(groupPrefix, groupIdx),
|
||||||
'maputnik-layer-list-item-group-last': idxInGroup == layers.length - 1 && layers.length > 1
|
'maputnik-layer-list-item-group-last': idxInGroup == layers.length - 1 && layers.length > 1
|
||||||
})}
|
})}
|
||||||
index={idx}
|
index={idx}
|
||||||
|
|
Loading…
Reference in a new issue