Fix slow appearance of nodes on tree view

The tree view rendering performance is optimized by improving the node
render queue ordering. The node rendering order is modified based on the
expansion state and the depth in the hierarchy, leading to faster
rendering of visible nodes. This optimization is applied when the tree
nodes are not expanded to improve the rendering speed.

This new ordering ensures that nodes are rendered more efficiently,
prioritizing nodes that are collapsed and are at a higher level in the
hierarchy.
This commit is contained in:
undergroundwires
2023-09-25 14:21:29 +02:00
parent 8f188acd3c
commit bd2082e8c5
13 changed files with 205 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ import { HierarchyAccess } from '@/presentation/components/Scripts/View/Tree/Tre
import { TreeNode } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/TreeNode';
export class HierarchyAccessStub implements HierarchyAccess {
public parent: TreeNode = undefined;
public parent: TreeNode | undefined = undefined;
public children: readonly TreeNode[] = [];
@@ -20,7 +20,7 @@ export class HierarchyAccessStub implements HierarchyAccess {
this.children = children;
}
public withParent(parent: TreeNode): this {
public withParent(parent: TreeNode | undefined): this {
this.parent = parent;
return this;
}

View File

@@ -0,0 +1,8 @@
import { ReadOnlyTreeNode } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/TreeNode';
import { RenderQueueOrderer } from '@/presentation/components/Scripts/View/Tree/TreeView/Rendering/Ordering/RenderQueueOrderer';
export class RenderQueueOrdererStub implements RenderQueueOrderer {
public orderNodes(nodes: Iterable<ReadOnlyTreeNode>): ReadOnlyTreeNode[] {
return [...nodes];
}
}

View File

@@ -26,4 +26,9 @@ export class TreeNodeStateDescriptorStub implements TreeNodeStateDescriptor {
this.isVisible = isVisible;
return this;
}
public withExpansion(isExpanded: boolean): this {
this.isExpanded = isExpanded;
return this;
}
}