Skip to content

Commit

Permalink
fix issue when toolbar not loaded and keymapping being activate
Browse files Browse the repository at this point in the history
  • Loading branch information
jparez committed Jul 26, 2024
1 parent af7ea80 commit 29e029c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugins/KeyboardMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ module.exports = class KeyboardMapping {

activatePlugin() {
if (this.state.isActive) {
this.toolbarBtnImage.classList.add('gm-active');
if (this.toolbarBtnImage) {
this.toolbarBtnImage.classList.add('gm-active');
}
this.addKeyboardCallbacks();
this.instance.store.dispatch({type: 'KEYBOARD_EVENTS_ENABLED', payload: false});
this.instance.store.dispatch({type: 'MOUSE_EVENTS_ENABLED', payload: false});
} else {
this.toolbarBtnImage.classList.remove('gm-active');
if (this.toolbarBtnImage) {
this.toolbarBtnImage.classList.remove('gm-active');
}
this.removeKeyboardCallbacks();
this.instance.store.dispatch({type: 'KEYBOARD_EVENTS_ENABLED', payload: !this.state.isPaused});
this.instance.store.dispatch({type: 'MOUSE_EVENTS_ENABLED', payload: !this.state.isPaused});
Expand Down

0 comments on commit 29e029c

Please sign in to comment.