修复点击眼睛图标时,整个场景树折叠bug。

This commit is contained in:
tengge1 2019-11-07 22:04:56 +08:00
parent 4cf2a57bbc
commit 80eec6c514
2 changed files with 30 additions and 23 deletions

View File

@ -42,6 +42,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en
28. 新建三维园区。
29. 工具栏改为横向,并进行分类。
30. 禁用鼠标放到物体上高亮。
31. 修复点击眼睛图标时整个场景树折叠bug。
## v0.3.6更新

View File

@ -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;