From a63bfa7ea80e1a02d01d7c3b805582c366e38cd6 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 21 Aug 2018 23:52:00 +0900 Subject: [PATCH] refs #543 Set shortcut key to move toot in list timeline --- .../TimelineSpace/Contents/Lists/Show.vue | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue b/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue index 8fe5dd6e..0cc5632c 100644 --- a/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue +++ b/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue @@ -4,8 +4,18 @@
-
- +
+ +
@@ -25,6 +35,11 @@ export default { name: 'list', props: ['list_id'], components: { Toot }, + data () { + return { + focusedIndex: null + } + }, computed: { ...mapState({ backgroundColor: state => state.App.theme.background_color, @@ -59,6 +74,14 @@ export default { this.$store.commit('TimelineSpace/HeaderMenu/changeReload', false) }) } + }, + focusedIndex: function (newState, oldState) { + if (newState >= 0 && this.heading) { + this.$store.commit('TimelineSpace/Contents/Lists/Show/changeHeading', false) + } else if (newState === null && !this.heading) { + this.$store.commit('TimelineSpace/Contents/Lists/Show/changeHeading', true) + this.$store.commit('TimelineSpace/Contents/Lists/Show/mergeTimeline') + } } }, beforeDestroy () { @@ -113,6 +136,7 @@ export default { } else if ((event.target.scrollTop <= 10) && !this.heading) { this.$store.commit('TimelineSpace/Contents/Lists/Show/changeHeading', true) this.$store.commit('TimelineSpace/Contents/Lists/Show/mergeTimeline') + this.focusedIndex = null } }, async reload () { @@ -130,7 +154,7 @@ export default { await this.$store.dispatch('TimelineSpace/stopLocalStreaming') await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/stopStreaming') - await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account) + await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', account) await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account) await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', this.list_id) .catch(() => { @@ -158,6 +182,24 @@ export default { document.getElementById('scrollable'), 0 ) + this.focusedIndex = null + }, + focusNext () { + if (this.focusedIndex === null) { + this.focusedIndex = 0 + } else if (this.focusedIndex < this.timeline.length) { + this.focusedIndex++ + } + }, + focusPrev () { + if (this.focusedIndex === 0) { + this.focusedIndex = null + } else if (this.focusedIndex > 0) { + this.focusedIndex-- + } + }, + focusToot (index) { + this.focusedIndex = index } } }