Reset current subtab in all tabs on game load

Fixes #740
This commit is contained in:
Andrei Andreev 2019-08-11 14:33:29 +03:00
parent a074a94c12
commit d18b429788

View File

@ -66,6 +66,10 @@ class TabState {
Modal.hide();
EventHub.dispatch(GameEvent.TAB_CHANGED);
}
resetCurrentSubtab() {
this._currentSubtab = this.subtabs[0];
}
}
const Tab = GameDatabase.tabs.mapToObject(
@ -81,3 +85,9 @@ const Tabs = (function() {
}
};
}());
EventHub.logic.on(GameEvent.GAME_LOAD, () => {
for (const tab of Tabs.all) {
tab.resetCurrentSubtab();
}
});