diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-05-26 11:09:38 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-05-26 11:26:41 +1000 |
| commit | 2d67e54dc91708eaf89eca9dca27cec126f7f465 (patch) | |
| tree | 98c59ada5a9e325e77eaedb57bdd444a6be989f8 /src/components | |
| parent | eb72584af8f5a598740a87ee024d0d899fdffc8d (diff) | |
Make ancestry-bar scroll-to-end when added to
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/AncestryBar.vue | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/AncestryBar.vue b/src/components/AncestryBar.vue index 2dd19fb..66c1b13 100644 --- a/src/components/AncestryBar.vue +++ b/src/components/AncestryBar.vue @@ -67,6 +67,14 @@ export default defineComponent({ }; }, }, + watch: { + nodes(){ + setTimeout(() => this.scrollToEnd(), 0); // Without timeout, seems to run before new tiles are added + }, + wideArea(){ + setTimeout(() => this.scrollToEnd(), 0); + }, + }, methods: { onTileClick(node: LayoutNode){ this.$emit('detached-ancestor-click', node); @@ -80,6 +88,16 @@ export default defineComponent({ this.$el.scrollLeft -= (evt.deltaY > 0 ? 30 : -30); } }, + scrollToEnd(){ + if (this.wideArea){ + this.$el.scrollLeft = this.$el.scrollWidth; + } else { + this.$el.scrollTop = this.$el.scrollHeight; + } + }, + }, + mounted(){ + this.scrollToEnd(); }, components: {Tile, }, emits: ['detached-ancestor-click', 'info-icon-click', ], |
