mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
refactor casting spells on the client side (#9949)
This commit is contained in:
@@ -188,22 +188,12 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
this.$root.$on('castEnd', (target, type, $event) => {
|
||||
this.castEnd(target, type, $event);
|
||||
});
|
||||
|
||||
document.addEventListener('keyup', this.handleKeyUp);
|
||||
|
||||
// @TODO: should we abstract the drawer state/local store to a library and mixing combo? We use a similar pattern in equipment
|
||||
const spellDrawerState = getLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE);
|
||||
if (spellDrawerState === CONSTANTS.valueConstants.DRAWER_CLOSED) {
|
||||
this.$store.state.spellOptions.spellDrawOpen = false;
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$root.$off('castEnd');
|
||||
document.removeEventListener('keyup', this.handleKeyUp);
|
||||
},
|
||||
computed: {
|
||||
...mapState({user: 'user.data'}),
|
||||
openStatus () {
|
||||
@@ -211,10 +201,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleKeyUp (keyEvent) {
|
||||
if (keyEvent.keyCode !== 27) return;
|
||||
this.castCancel();
|
||||
},
|
||||
drawerToggled (newState) {
|
||||
this.$store.state.spellOptions.spellDrawOpen = newState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user