From ab97a285a700743169c56aecb1ba3e8d05f32fbb Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Mon, 21 Mar 2022 17:49:16 +1100 Subject: Avoid changing DOM-bound tree before new layout is determined Also made layout functions modify the passed-in tree instead of generating a new tree. And added type LayoutTreeChg. --- src/components/TileTree.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index c277556..bdc3959 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -68,7 +68,8 @@ export default defineComponent({ //console.log('Tile to expand has no children'); return; } - let success = this.layoutTree.tryLayoutOnExpand([0,0], [this.width,this.height], layoutNode); + let success = this.layoutTree.tryLayout([0,0], [this.width,this.height], + {type: 'expand', node: layoutNode}); if (!success){ // Trigger failure animation domNode.classList.remove('animate-expand-shrink'); @@ -78,7 +79,8 @@ export default defineComponent({ } }, onInnerHeaderClicked({layoutNode, domNode}: {layoutNode: LayoutNode, domNode: HTMLElement}){ - let success = this.layoutTree.tryLayoutOnCollapse([0,0], [this.width,this.height], layoutNode); + let success = this.layoutTree.tryLayout([0,0], [this.width,this.height], + {type: 'collapse', node: layoutNode}); if (!success){ // Trigger failure animation domNode.classList.remove('animate-shrink-expand'); -- cgit v1.2.3