From 0f963472253e3ac1c874da20f72b87e16707fc5f Mon Sep 17 00:00:00 2001 From: Tom Herold Date: Mon, 15 Jul 2019 12:56:48 +0200 Subject: [PATCH] Fixed Bug with Collapse/Expand All Tree Groups (#4178) * fixed expand all trees bug #4162 * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../oxalis/view/right-menu/tree_hierarchy_view.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10307933f0c..d921ba7246a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 - diff --git a/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js b/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js index d111a08b104..ed635eadbd6 100644 --- a/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js +++ b/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js @@ -181,18 +181,23 @@ class TreeHierarchyView extends React.PureComponent { }; 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: {