summaryrefslogtreecommitdiff
path: root/src/client/app/store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/store.ts')
-rw-r--r--src/client/app/store.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/client/app/store.ts b/src/client/app/store.ts
index e6c3863d7f..0dbdf9bd5e 100644
--- a/src/client/app/store.ts
+++ b/src/client/app/store.ts
@@ -182,6 +182,17 @@ export default (os: MiOS) => new Vuex.Store({
state.deck.layout = state.deck.layout.map(ids => ids.filter(x => x != id));
},
+ swapDeckColumn(state, x) {
+ const a = x.a;
+ const b = x.b;
+ const aX = state.deck.layout.findIndex(ids => ids.indexOf(a) != -1);
+ const aY = state.deck.layout[aX].findIndex(id => id == a);
+ const bX = state.deck.layout.findIndex(ids => ids.indexOf(b) != -1);
+ const bY = state.deck.layout[bX].findIndex(id => id == b);
+ state.deck.layout[aX][aY] = b;
+ state.deck.layout[bX][bY] = a;
+ },
+
swapLeftDeckColumn(state, id) {
state.deck.layout.some((ids, i) => {
if (ids.indexOf(id) != -1) {
@@ -306,6 +317,11 @@ export default (os: MiOS) => new Vuex.Store({
ctx.dispatch('saveDeck');
},
+ swapDeckColumn(ctx, id) {
+ ctx.commit('swapDeckColumn', id);
+ ctx.dispatch('saveDeck');
+ },
+
swapLeftDeckColumn(ctx, id) {
ctx.commit('swapLeftDeckColumn', id);
ctx.dispatch('saveDeck');