diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/App.vue | 3 | ||||
| -rw-r--r-- | src/util.ts | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/App.vue b/src/App.vue index 4096ec0..d6c1d7a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -86,7 +86,7 @@ import HelpIcon from './components/icon/HelpIcon.vue'; import {TolNode, TolMap, Action, UiOptions} from './lib'; import {LayoutNode, LayoutOptions, LayoutTreeChg} from './layout'; import {initLayoutTree, initLayoutMap, tryLayout} from './layout'; -import {getServerResponse, getBreakpoint, getScrollBarWidth, arraySum, randWeightedChoice} from './util'; +import {getServerResponse, getBreakpoint, getScrollBarWidth, arraySum, randWeightedChoice, timeout} from './util'; // Type representing auto-mode actions type AutoAction = 'move across' | 'move down' | 'move up' | Action; @@ -730,6 +730,7 @@ export default defineComponent({ await this.onDetachedAncestorClick(this.layoutTree); } await this.onNonleafClick(this.layoutTree); + await timeout(this.uiOpts.transitionDuration); await this.initTreeFromServer(); }, onResetSettings(): void { diff --git a/src/util.ts b/src/util.ts index 6d713a8..1ed019c 100644 --- a/src/util.ts +++ b/src/util.ts @@ -151,3 +151,7 @@ export function capitalizeWords(str: string){ str = str.replace(/(\w)'S/, '$1\'s'); // Avoid cases like "traveler's tree" -> "Traveler'S Tree" return str; } +// Used to async-await for until after a timeout +export async function timeout(ms: number){ + return new Promise(resolve => setTimeout(resolve, ms)) +} |
