mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
resize elements from center point (#1225)
* add hint & support multi-line hints * resize from center point using the new resize maths * resize with origin element when lifting alt key * add readonly to elementOriginPosition * add setResizeWithCenterKeyLifted * isResizeFromCenter logic * offsetX and offsetY * simplify equations * creating element from center point * lint * lint * lint * remove revert on key up logic Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: daishi <daishi@axlight.com>
This commit is contained in:
parent
8c49770e3b
commit
ed6fb60337
6 changed files with 69 additions and 22 deletions
|
@ -14,6 +14,7 @@ export const KEYS = {
|
|||
SPACE: " ",
|
||||
QUESTION_MARK: "?",
|
||||
F_KEY_CODE: 70,
|
||||
ALT_KEY_CODE: 18,
|
||||
} as const;
|
||||
|
||||
export type Key = keyof typeof KEYS;
|
||||
|
@ -26,3 +27,8 @@ export function isArrowKey(keyCode: string) {
|
|||
keyCode === KEYS.ARROW_UP
|
||||
);
|
||||
}
|
||||
|
||||
export const getResizeCenterPointKey = (event: MouseEvent | KeyboardEvent) =>
|
||||
event.altKey || event.which === KEYS.ALT_KEY_CODE;
|
||||
export const getResizeWithSidesSameLengthKey = (event: MouseEvent) =>
|
||||
event.shiftKey;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue