From 19f003bf3aca7f3524bddf2c90c69ab12d8e2cc8 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 21 Aug 2018 23:09:33 +0900 Subject: [PATCH] refs #543 Set shortcut key to move toot in favourite --- .../TimelineSpace/Contents/Favourites.vue | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents/Favourites.vue b/src/renderer/components/TimelineSpace/Contents/Favourites.vue index 187f2e1d..4760251d 100644 --- a/src/renderer/components/TimelineSpace/Contents/Favourites.vue +++ b/src/renderer/components/TimelineSpace/Contents/Favourites.vue @@ -2,8 +2,18 @@
-
- +
+ +
@@ -24,7 +34,8 @@ export default { components: { Toot }, data () { return { - heading: true + heading: true, + focusedIndex: null } }, computed: { @@ -68,6 +79,13 @@ export default { this.$store.commit('TimelineSpace/HeaderMenu/changeReload', false) }) } + }, + focusedIndex: function (newState, oldState) { + if (newState > 0 && this.heading) { + this.heading = false + } else if (newState === null && !this.heading) { + this.heading = true + } } }, methods: { @@ -92,6 +110,7 @@ export default { this.heading = false } else if ((event.target.scrollTop <= 10) && !this.heading) { this.heading = true + this.focusedIndex = null } }, async reload () { @@ -129,6 +148,24 @@ export default { document.getElementById('scrollable'), 0 ) + this.focusedIndex = null + }, + focusNext () { + if (this.focusedIndex === null) { + this.focusedIndex = 0 + } else if (this.focusedIndex < this.favourites.length) { + this.focusedIndex++ + } + }, + focusPrev () { + if (this.focusedIndex === 0) { + this.focusedIndex = null + } else if (this.focusedIndex > 0) { + this.focusedIndex-- + } + }, + focusToot (index) { + this.focusedIndex = index } } }