Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/SOF-7278 remove triggering threejs editor in non-editable #151

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/ThreeDEditor.jsx
Original file line number Diff line number Diff line change
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