Skip to content

Commit

Permalink
Fixed Bug with Collapse/Expand All Tree Groups (#4178)
Browse files Browse the repository at this point in the history
* fixed expand all trees bug #4162

* Update CHANGELOG.md
  • Loading branch information
hotzenklotz authored Jul 15, 2019
1 parent 0ccda10 commit 0f96347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

### Fixed
- Fixed a bug where volume tracings could not be converted to hybrid. [#4159](https://github.com/scalableminds/webknossos/pull/4159)
- Fixed a bug where collapsing/expanding all tree groups would trigger when toggling a single tree [#4178](https://github.com/scalableminds/webknossos/pull/4178)

### Removed
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,23 @@ class TreeHierarchyView extends React.PureComponent<Props, State> {
};

setExpansionOfAllSubgroupsTo = (groupId: number, expanded: boolean) => {
const newExpandedGroupIds = Object.assign({}, this.state.expandedGroupIds);
const collapseAllGroups = groupTree => {
const copyOfGroupTree = _.cloneDeep(groupTree);
findTreeNode(copyOfGroupTree, groupId, item => {
forEachTreeNode(item.children, node => {
if (node.type === TYPE_GROUP) {
node.expanded = expanded;
newExpandedGroupIds[node.id] = expanded;
}
});
});
return copyOfGroupTree;
};
this.setState(prevState => ({ groupTree: collapseAllGroups(prevState.groupTree) }));
this.setState(prevState => ({
groupTree: collapseAllGroups(prevState.groupTree),
expandedGroupIds: newExpandedGroupIds,
}));
};

onMoveNode = (params: {
Expand Down

0 comments on commit 0f96347

Please sign in to comment.