Skip to content

Commit

Permalink
Allow hiding object children
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Sep 21, 2024
1 parent c7dd197 commit c1da76c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/hub/SourceList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,16 +802,17 @@ export default class SourceList {
// Hide button
let hideButton = item.getElementsByClassName("hide")[0] as HTMLButtonElement;
let toggleHidden = () => {
if (isChild) return;
let index = Array.from(this.LIST.children).indexOf(item);
let newVisible = !this.state[index].visible;
this.state[index].visible = newVisible;
this.updateItem(item, this.state[index]);
while (index < this.state.length) {
index++;
if (!this.isChild(index)) break;
this.state[index].visible = newVisible;
this.updateItem(this.LIST.children[index] as HTMLElement, this.state[index]);
if (!isChild) {
while (index < this.state.length) {
index++;
if (!this.isChild(index)) break;
this.state[index].visible = newVisible;
this.updateItem(this.LIST.children[index] as HTMLElement, this.state[index]);
}
}
};
hideButton.addEventListener("click", (event) => {
Expand All @@ -833,7 +834,6 @@ export default class SourceList {

// Child formatting
if (isChild) {
hideButton.hidden = true;
item.classList.add("child");
}

Expand Down

0 comments on commit c1da76c

Please sign in to comment.