inspector: add solo mode with alt+click for category panels

This commit is contained in:
jean-emmanuel 2022-03-08 08:50:32 +01:00
parent a9c1f01e8e
commit 8257c9019c
2 changed files with 19 additions and 3 deletions

View file

@ -25,8 +25,19 @@ class UiInspector extends UiWidget {
this.container.addEventListener('fast-click', (e)=>{
if (e.target.classList.contains('category-header')) {
var name = e.target.getAttribute('data-name'),
expandedIndex = this.expandedCategories.indexOf(name)
var name = e.target.getAttribute('data-name')
if (e.detail.altKey) {
DOM.each(this.container, 'osc-inspector-category.expanded', (item)=>{
let iname = item.firstChild.getAttribute('data-name'),
index = this.expandedCategories.indexOf(iname)
if (iname !== name) {
if (index > -1) this.expandedCategories.splice(index, 1)
item.classList.remove('expanded')
}
})
}
var expandedIndex = this.expandedCategories.indexOf(name)
e.target.parentNode.classList.toggle('expanded', expandedIndex < 0)
if (expandedIndex > -1) {
this.expandedCategories.splice(expandedIndex, 1)