Skip to content

Commit

Permalink
update: remove e hotlistener on non-editable
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Mar 28, 2024
1 parent 72baf89 commit aa2cc3d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/ThreeDEditor.jsx
Expand Up @@ -174,6 +174,7 @@ export class ThreeDEditor extends React.Component {

handleKeyPress = (e) => {
const { isInteractive, isThreejsEditorModalShown } = this.state;
const { editable } = this.props;

// Check if interactive mode is off, or if the event originated from an input-like element
if (
Expand All @@ -185,7 +186,13 @@ export class ThreeDEditor extends React.Component {
return;
}

const handler = this.keyConfig[e.key.toLowerCase()];
// Removing the toggleThreejsEditorModal key from the keyConfig if the editor is not editable
const keyConfigAdjusted = { ...this.keyConfig };
if (!editable) {
delete keyConfigAdjusted[settings.hotKeysConfig.toggleThreejsEditorModal];
}

const handler = keyConfigAdjusted[e.key.toLowerCase()];
if (handler) {
handler.call(this);
}
Expand Down

0 comments on commit aa2cc3d

Please sign in to comment.