Skip to content

Commit

Permalink
Add page up/down to navigate to far left/right.
Browse files Browse the repository at this point in the history
  • Loading branch information
sustained committed Feb 26, 2019
1 parent 319fd00 commit ccfc71a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,22 @@ export default new Vuex.Store({
},

actions: {
navigateLeft({ commit, state }) {
navigateLeft({ commit, state }, toEnd = false) {
if (state.isNavigating || state.disableNavigation) return;
commit("SET_NAVIGATING", true);

if (toEnd) return commit("SET_CURRENT_LIST", 0);

if (state.currentList - 1 < 0) commit("SET_CURRENT_LIST", state.groupListCounts[state.currentGroup] - 1);
else commit("SET_CURRENT_LIST", state.currentList - 1);
},

navigateRight({ commit, state }) {
navigateRight({ commit, state }, toEnd = false) {
if (state.isNavigating || state.disableNavigation) return;
commit("SET_NAVIGATING", true);

if (toEnd) return commit("SET_CURRENT_LIST", state.groupListCounts[state.currentGroup] - 1);

if (state.currentList + 1 > state.groupListCounts[state.currentGroup] - 1) commit("SET_CURRENT_LIST", 0);
else commit("SET_CURRENT_LIST", state.currentList + 1);
},
Expand Down
8 changes: 8 additions & 0 deletions src/views/ViewBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ export default {
case 69: // E
// this.$store.dispatch("editListTitle");
break;
case 33: // Page Up
this.$store.dispatch("navigateLeft", true);
break;
case 34: // Page Down
this.$store.dispatch("navigateRight", true);
break;
}
}
}
Expand Down

0 comments on commit ccfc71a

Please sign in to comment.