diff --git a/README.md b/README.md index caba3791..2de83c61 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en 28. 新建三维园区。 29. 工具栏改为横向,并进行分类。 30. 禁用鼠标放到物体上高亮。 +31. 修复点击眼睛图标时,整个场景树折叠bug。 ## v0.3.6更新 diff --git a/ShadowEditor.Web/src/editor/sidebar/HierarchyPanel.jsx b/ShadowEditor.Web/src/editor/sidebar/HierarchyPanel.jsx index 3e2f4106..b8b67f28 100644 --- a/ShadowEditor.Web/src/editor/sidebar/HierarchyPanel.jsx +++ b/ShadowEditor.Web/src/editor/sidebar/HierarchyPanel.jsx @@ -114,9 +114,36 @@ class HierarchyPanel extends React.Component { return; } - let data = this.state.data; let selected = object.uuid; + this.setState({ + selected + }, () => { + this.updateUI(); + }); + } + + /** + * 根据场景变化,更新场景树状图 + */ + updateUI() { + const scene = app.editor.scene; + const camera = app.editor.camera; + + let data = [{ + value: camera.uuid, + text: camera.name, + cls: 'Camera', + expanded: false, + checked: this.checked[camera.uuid] || false, + draggable: false, + children: [] + }]; + + this._parseData(scene, data); + + const selected = this.state.selected; + this.expandData(selected, data); this.setState({ @@ -134,6 +161,7 @@ class HierarchyPanel extends React.Component { } if (this.expandData(uuid, item.children)) { // 找到了,父节点也要展开 + this.expanded[item.uuid] = true; item.expanded = true; return true; } @@ -141,28 +169,6 @@ class HierarchyPanel extends React.Component { return false; } - /** - * 根据场景变化,更新场景树状图 - */ - updateUI() { - const scene = app.editor.scene; - const camera = app.editor.camera; - - let list = [{ - value: camera.uuid, - text: camera.name, - cls: 'Camera', - expanded: false, - checked: this.checked[camera.uuid] || false, - draggable: false, - children: [] - }]; - - this._parseData(scene, list); - - this.setState({ data: list }); - } - _parseData(obj, list) { const scene = app.editor.scene; const camera = app.editor.camera;