diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-27 14:56:38 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-27 14:56:38 +1100 |
| commit | 97913d8347fc35ee569d8364b2e10e2c38a21380 (patch) | |
| tree | cfd889e81a3a274a07fdc1931451777a52610e8f /src/App.vue | |
| parent | 81444240bbb3de18fdace459a61d461ef46dc16a (diff) | |
Simplify Tile transition-on-expand/collapse code
Diffstat (limited to 'src/App.vue')
| -rw-r--r-- | src/App.vue | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/App.vue b/src/App.vue index cd6731a..91cb7bc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -182,26 +182,20 @@ export default defineComponent({ } }, // For tile expand/collapse events - onInnerLeafClicked({layoutNode, domNode}: {layoutNode: LayoutNode, domNode?: HTMLElement}){ + onInnerLeafClicked({layoutNode, failCallback}: {layoutNode: LayoutNode, failCallback?: () => void}){ let success = tryLayout(this.activeRoot, this.layoutMap, this.tileAreaPos, this.tileAreaDims, this.layoutOptions, false, {type: 'expand', node: layoutNode}); - if (!success && domNode != null){ - // Trigger failure animation - domNode.classList.remove('animate-expand-shrink'); - domNode.offsetWidth; // Triggers reflow - domNode.classList.add('animate-expand-shrink'); + if (!success && failCallback != null){ + failCallback(); } return success; }, - onInnerHeaderClicked({layoutNode, domNode}: {layoutNode: LayoutNode, domNode?: HTMLElement}){ + onInnerHeaderClicked({layoutNode, failCallback}: {layoutNode: LayoutNode, failCallback?: () => void}){ let oldChildren = layoutNode.children; let success = tryLayout(this.activeRoot, this.layoutMap, this.tileAreaPos, this.tileAreaDims, this.layoutOptions, false, {type: 'collapse', node: layoutNode}); - if (!success && domNode != null){ - // Trigger failure animation - domNode.classList.remove('animate-shrink-expand'); - domNode.offsetWidth; // Triggers reflow - domNode.classList.add('animate-shrink-expand'); + if (!success && failCallback != null){ + failCallback(); } return success; }, |
