From ef4a9b9223d6019f0b782eb2f944f3cfe2b6ed41 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 8 Jul 2022 00:24:47 +1000 Subject: Adjust SCollapsible, allowing for v-model and @open --- src/App.vue | 64 ++++++++++++------------- src/components/AncestryBar.vue | 18 +++---- src/components/HelpModal.vue | 10 ++-- src/components/SCollapsible.vue | 28 ++++++++--- src/components/SettingsModal.vue | 10 ++-- src/components/Tile.vue | 100 +++++++++++++++++++-------------------- src/components/TileInfoModal.vue | 2 +- src/components/TutorialPane.vue | 36 +++++++------- 8 files changed, 142 insertions(+), 126 deletions(-) diff --git a/src/App.vue b/src/App.vue index 1c4b74b..8e3bd11 100644 --- a/src/App.vue +++ b/src/App.vue @@ -251,38 +251,6 @@ export default defineComponent({ return styles; }, }, - watch: { - infoModalNodeName(newVal, oldVal){ - // Possibly trigger tutorial advance - if (newVal == null){ - this.handleActionForTutorial('tileInfo'); - } - }, - modeRunning(newVal, oldVal){ - // For sweepToParent setting 'fallback', temporarily change to 'prefer' for efficiency - if (newVal != null){ - if (this.lytOpts.sweepToParent == 'fallback'){ - this.lytOpts.sweepToParent = 'prefer'; - this.changedSweepToParent = true; - } - } else { - if (this.changedSweepToParent){ - this.lytOpts.sweepToParent = 'fallback'; - this.changedSweepToParent = false; - } - } - // Possibly trigger tutorial advance - if (newVal == null){ - this.handleActionForTutorial(oldVal); - } - }, - settingsOpen(newVal, oldVal){ - // Possibly trigger tutorial advance - if (newVal == false){ - this.handleActionForTutorial('settings'); - } - }, - }, methods: { // For tile expand/collapse events async onLeafClick(layoutNode: LayoutNode, subAction = false): Promise { @@ -1033,6 +1001,38 @@ export default defineComponent({ return actions.some(a => disabledActions.has(a)); }, }, + watch: { + infoModalNodeName(newVal, oldVal){ + // Possibly trigger tutorial advance + if (newVal == null){ + this.handleActionForTutorial('tileInfo'); + } + }, + modeRunning(newVal, oldVal){ + // For sweepToParent setting 'fallback', temporarily change to 'prefer' for efficiency + if (newVal != null){ + if (this.lytOpts.sweepToParent == 'fallback'){ + this.lytOpts.sweepToParent = 'prefer'; + this.changedSweepToParent = true; + } + } else { + if (this.changedSweepToParent){ + this.lytOpts.sweepToParent = 'fallback'; + this.changedSweepToParent = false; + } + } + // Possibly trigger tutorial advance + if (newVal == null){ + this.handleActionForTutorial(oldVal); + } + }, + settingsOpen(newVal, oldVal){ + // Possibly trigger tutorial advance + if (newVal == false){ + this.handleActionForTutorial('settings'); + } + }, + }, created(){ window.addEventListener('resize', this.onResize); window.addEventListener('keydown', this.onKeyUp); diff --git a/src/components/AncestryBar.vue b/src/components/AncestryBar.vue index e7ba8a5..fcf9933 100644 --- a/src/components/AncestryBar.vue +++ b/src/components/AncestryBar.vue @@ -51,15 +51,6 @@ export default defineComponent({ }; }, }, - watch: { - // Used to scroll to end of bar upon node/screen changes - nodes(){ - this.$nextTick(() => this.scrollToEnd()); - }, - vert(){ - this.$nextTick(() => this.scrollToEnd()); - }, - }, methods: { // Click events onTileClick(node: LayoutNode){ @@ -83,6 +74,15 @@ export default defineComponent({ } }, }, + watch: { + // Used to scroll to end of bar upon node/screen changes + nodes(){ + this.$nextTick(() => this.scrollToEnd()); + }, + vert(){ + this.$nextTick(() => this.scrollToEnd()); + }, + }, mounted(){ this.scrollToEnd(); }, diff --git a/src/components/HelpModal.vue b/src/components/HelpModal.vue index 9f7ff0b..3e30c9f 100644 --- a/src/components/HelpModal.vue +++ b/src/components/HelpModal.vue @@ -9,7 +9,7 @@ @@ -46,7 +46,7 @@ @@ -110,7 +110,7 @@ @@ -228,7 +228,7 @@ @@ -336,7 +336,7 @@ diff --git a/src/components/SCollapsible.vue b/src/components/SCollapsible.vue index 4570ee0..5b49c8c 100644 --- a/src/components/SCollapsible.vue +++ b/src/components/SCollapsible.vue @@ -1,10 +1,10 @@