don't use unicode characters for shortcut help (#1565)

* don't use unicode characters for shortcut help

* use option instead of alt

* make shortcut replacement case-insensitive

* improve shortcut dialog layout
This commit is contained in:
David Luzar 2020-05-11 00:29:35 +02:00 committed by GitHub
parent 394237728f
commit a90ca5eb84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 42 deletions

View file

@ -158,14 +158,12 @@ export const getShortcutKey = (shortcut: string): string => {
const isMac = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
if (isMac) {
return `${shortcut
.replace("CtrlOrCmd+", "⌘")
.replace("Alt+", "⌥")
.replace("Ctrl+", "⌃")
.replace("Shift+", "⇧")
.replace("Del", "⌫")
.replace(/Enter|Return/, "↩")}`;
.replace(/CtrlOrCmd/i, "Cmd")
.replace(/Alt/i, "Option")
.replace(/Del/i, "Delete")
.replace(/Enter|Return/i, "Enter")}`;
}
return `${shortcut.replace("CtrlOrCmd", "Ctrl")}`;
return `${shortcut.replace(/CtrlOrCmd/i, "Ctrl")}`;
};
export function viewportCoordsToSceneCoords(
{ clientX, clientY }: { clientX: number; clientY: number },