Update send/bring shortcuts and show them properly per operating… (#784)

* Show proper shortcuts

* sort

* Add shortcuts to bring/send

* fix hotkeys matching greedily

* Space

* align zindex shortcuts with figma

* switch to event.code & change Darwin shortcuts

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Lipis 2020-03-09 15:06:35 +02:00 committed by GitHub
parent f9edb1b4ac
commit 9de3716324
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 29 deletions

View file

@ -6,6 +6,7 @@ import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
import { getNormalizedZoom } from "../scene";
import { KEYS } from "../keys";
import { getShortcutKey } from "../utils";
import useIsMobile from "../is-mobile";
import { register } from "./register";
@ -83,7 +84,7 @@ export const actionZoomIn = register({
<ToolButton
type="button"
icon={zoomIn}
title={t("buttons.zoomIn")}
title={`${t("buttons.zoomIn")} ${getShortcutKey("CtrlOrCmd++")}`}
aria-label={t("buttons.zoomIn")}
onClick={() => {
updateData(null);
@ -92,7 +93,7 @@ export const actionZoomIn = register({
),
keyTest: event =>
(event.code === KEY_CODES.EQUAL || event.code === KEY_CODES.NUM_ADD) &&
(event[KEYS.META] || event.shiftKey),
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});
export const actionZoomOut = register({
@ -109,7 +110,7 @@ export const actionZoomOut = register({
<ToolButton
type="button"
icon={zoomOut}
title={t("buttons.zoomOut")}
title={`${t("buttons.zoomOut")} ${getShortcutKey("CtrlOrCmd+-")}`}
aria-label={t("buttons.zoomOut")}
onClick={() => {
updateData(null);
@ -118,7 +119,7 @@ export const actionZoomOut = register({
),
keyTest: event =>
(event.code === KEY_CODES.MINUS || event.code === KEY_CODES.NUM_SUBTRACT) &&
(event[KEYS.META] || event.shiftKey),
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});
export const actionResetZoom = register({
@ -144,5 +145,5 @@ export const actionResetZoom = register({
),
keyTest: event =>
(event.code === KEY_CODES.ZERO || event.code === KEY_CODES.NUM_ZERO) &&
(event[KEYS.META] || event.shiftKey),
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});