Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen committed 2021-04-19 21:14:59 +03:00
1 parent f849a75c7c
commit 11435e71ea
2 files changed
+22 -14

No files matched your search

+20
View File
@@ -106,6 +106,26 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
}
switchToPrevious() {
let index = hotbarStore.activeHotbarIndex - 1;
if (index < 0) {
index = hotbarStore.hotbars.length - 1;
}
hotbarStore.activeHotbarId = hotbarStore.hotbars[index].id;
}
switchToNext() {
let index = hotbarStore.activeHotbarIndex + 1;
if (index >= hotbarStore.hotbars.length) {
index = 0;
}
hotbarStore.activeHotbarId = hotbarStore.hotbars[index].id;
}
toJSON(): HotbarStoreModel {
const model: HotbarStoreModel = {
hotbars: this.hotbars,
+2 -14
View File
@@ -44,23 +44,11 @@ export class HotbarMenu extends React.Component<Props> {
}
previous() {
let index = hotbarStore.activeHotbarIndex - 1;
if (index < 0) {
index = hotbarStore.hotbars.length - 1;
}
hotbarStore.activeHotbarId = hotbarStore.hotbars[index].id;
hotbarStore.switchToPrevious();
}
next() {
let index = hotbarStore.activeHotbarIndex + 1;
if (index >= hotbarStore.hotbars.length) {
index = 0;
}
hotbarStore.activeHotbarId = hotbarStore.hotbars[index].id;
hotbarStore.switchToNext();
}
openSelector() {