Skip to content

Commit

Permalink
Merge pull request #12855 from carolhmj/GUIEditorFixShortcuts
Browse files Browse the repository at this point in the history
Fix shortcuts firing while user inputs text

Former-commit-id: 14470667c9c73d27da367161b22f2bcdcbfa7a6b
  • Loading branch information
sebavan authored Aug 9, 2022
2 parents 44934a5 + 72fa9f3 commit 694e04e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/tools/guiEditor/src/globalState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class GlobalState {
public get tool(): GUIEditorTool {
if (this._tool === GUIEditorTool.ZOOM) {
return GUIEditorTool.ZOOM;
} else if (this._tool === GUIEditorTool.PAN || this.keys.isKeyDown("space")) {
} else if (this._tool === GUIEditorTool.PAN) {
return GUIEditorTool.PAN;
} else {
return GUIEditorTool.SELECT;
Expand Down
5 changes: 5 additions & 0 deletions packages/tools/guiEditor/src/workbenchEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
}

addToolControls = (evt: KeyboardEvent) => {
// If the event target is a text input, we're currently focused on it, and the user
// just wants to type normal text
if (evt.target && evt.target instanceof HTMLInputElement && evt.target.type === "text") {
return;
}
switch (evt.key) {
case "s": //select
case "S":
Expand Down

0 comments on commit 694e04e

Please sign in to comment.