mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
f9edb1b4ac
commit
9de3716324
9 changed files with 65 additions and 29 deletions
|
@ -5,7 +5,7 @@ import { hasBackground, hasStroke, hasText } from "../scene";
|
|||
import { t } from "../i18n";
|
||||
import { SHAPES } from "../shapes";
|
||||
import { ToolButton } from "./ToolButton";
|
||||
import { capitalizeString } from "../utils";
|
||||
import { capitalizeString, getShortcutKey } from "../utils";
|
||||
import { CURSOR_TYPE } from "../constants";
|
||||
import Stack from "./Stack";
|
||||
|
||||
|
@ -78,6 +78,9 @@ export function ShapesSwitcher({
|
|||
<>
|
||||
{SHAPES.map(({ value, icon }, index) => {
|
||||
const label = t(`toolBar.${value}`);
|
||||
const shortcut = getShortcutKey(
|
||||
`${capitalizeString(value)[0]}, ${index + 1}`,
|
||||
);
|
||||
return (
|
||||
<ToolButton
|
||||
key={value}
|
||||
|
@ -85,9 +88,7 @@ export function ShapesSwitcher({
|
|||
icon={icon}
|
||||
checked={elementType === value}
|
||||
name="editor-current-shape"
|
||||
title={`${capitalizeString(label)} — ${
|
||||
capitalizeString(value)[0]
|
||||
}, ${index + 1}`}
|
||||
title={`${capitalizeString(label)} ${shortcut}`}
|
||||
keyBindingLabel={`${index + 1}`}
|
||||
aria-label={capitalizeString(label)}
|
||||
aria-keyshortcuts={`${label[0]} ${index + 1}`}
|
||||
|
|
|
@ -1769,7 +1769,7 @@ export class App extends React.Component<any, AppState> {
|
|||
event.preventDefault();
|
||||
const { deltaX, deltaY } = event;
|
||||
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (event[KEYS.CTRL_OR_CMD]) {
|
||||
const sign = Math.sign(deltaY);
|
||||
const MAX_STEP = 10;
|
||||
let delta = Math.abs(deltaY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue