Fixes in Shortcuts dialog and minor refactor (#1297)

This commit is contained in:
Lipis 2020-04-07 14:39:06 +03:00 committed by GitHub
parent e4c154f43e
commit 0c3d34261e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 96 additions and 82 deletions

View file

@ -161,17 +161,17 @@ export const allowFullScreen = () =>
export const exitFullScreen = () => document.exitFullscreen();
export const getShortcutKey = (shortcut: string, prefix = " — "): string => {
export const getShortcutKey = (shortcut: string): string => {
const isMac = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
if (isMac) {
return `${prefix}${shortcut
return `${shortcut
.replace("CtrlOrCmd+", "⌘")
.replace("Alt+", "⌥")
.replace("Ctrl+", "⌃")
.replace("Shift+", "⇧")
.replace("Del", "⌫")}`;
}
return `${prefix}${shortcut.replace("CtrlOrCmd", "Ctrl")}`;
return `${shortcut.replace("CtrlOrCmd", "Ctrl")}`;
};
export function viewportCoordsToSceneCoords(
{ clientX, clientY }: { clientX: number; clientY: number },