Add a Shortcut for Toggling Shape Lock (#1005)

* Update shortcuts.md for Lock

* Add 'Q' as a shortcut for toggling shape lock

* Add shortcut to LockIcon title

* use event.key instead

Co-authored-by: Faustino Kialungila <Faustino.kialungila@gmail.com>
This commit is contained in:
Sanghyeon Lee 2020-03-19 03:29:59 +09:00 committed by GitHub
parent cb68153a81
commit cb66adc716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 12 deletions

View file

@ -33,6 +33,7 @@ interface LayerUIProps {
setElements: (elements: readonly ExcalidrawElement[]) => void;
onRoomCreate: () => void;
onRoomDestroy: () => void;
onToggleLock: () => void;
}
export const LayerUI = React.memo(
@ -46,6 +47,7 @@ export const LayerUI = React.memo(
setElements,
onRoomCreate,
onRoomDestroy,
onToggleLock,
}: LayerUIProps) => {
const isMobile = useIsMobile();
@ -157,14 +159,7 @@ export const LayerUI = React.memo(
</Island>
<LockIcon
checked={appState.elementLocked}
onChange={() => {
setAppState({
elementLocked: !appState.elementLocked,
elementType: appState.elementLocked
? "selection"
: appState.elementType,
});
}}
onChange={onToggleLock}
title={t("toolBar.lock")}
isButton={isMobile}
/>