tree: clear expanded hash store, only expand root once at init
This commit is contained in:
parent
e9fb44884c
commit
eb857841a7
1 changed files with 11 additions and 2 deletions
|
|
@ -3,7 +3,8 @@ var UiWidget = require('./ui-widget'),
|
|||
doubleClick = require('../events/double-click'),
|
||||
Sortable = require('sortablejs'),
|
||||
morph = require('nanomorph'),
|
||||
Root, Panel, Matrix, Keyboard, widgetManager
|
||||
Root, Panel, Matrix, Keyboard, widgetManager,
|
||||
init = false
|
||||
|
||||
class UiTree extends UiWidget {
|
||||
|
||||
|
|
@ -170,7 +171,11 @@ class UiTree extends UiWidget {
|
|||
if (widget instanceof Panel && !(widget instanceof Matrix || widget instanceof Keyboard)) {
|
||||
node.insertBefore(html`<span class="toggle no-widget-select"></span>`, node.childNodes[0])
|
||||
node.classList.add('container')
|
||||
if (this.expanded[widget.hash] || widget instanceof Root) node.classList.add('expanded')
|
||||
if (this.expanded[widget.hash]) node.classList.add('expanded')
|
||||
if (!init && widget instanceof Root) {
|
||||
node.classList.add('expanded')
|
||||
init = true
|
||||
}
|
||||
var sublist = node.appendChild(html`<ol style="--depth:${++depth};"></ol>`)
|
||||
for (let child of widget.children) {
|
||||
if (child) sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth))
|
||||
|
|
@ -178,6 +183,10 @@ class UiTree extends UiWidget {
|
|||
|
||||
}
|
||||
|
||||
for (var h in this.expanded) {
|
||||
if (!widgetManager.widgets[h]) delete this.expanded[h]
|
||||
}
|
||||
|
||||
return node
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue