Refactoring in pointer down event handler, step 2 (#1887)

* Refactor: introduce pointer down state to replace implicit closure state with an explicit object

* Refactor: use pointer down state for resize handle

* Refactor: use pointer down state for isResizing

* Refactor: use pointer down state for resizing offset

* Refactor: use pointer down state for hit element

* Refactor: move selection handling out of pointer down event handler

* Refactor: move text handling out of pointer down event handler

* Refactor: move linear tools handling out of pointer down event handler

* Refactor: move element creation out of pointer down handler
This commit is contained in:
Michal Srb 2020-07-09 09:30:38 -07:00 committed by GitHub
parent 6cc6e13892
commit 5664de0459
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 417 additions and 299 deletions

View file

@ -241,3 +241,10 @@ const RE_RTL_CHECK = new RegExp(`^[^${RS_LTR_CHARS}]*[${RS_RTL_CHARS}]`);
export const isRTL = (text: string) => {
return RE_RTL_CHECK.test(text);
};
export function tupleToCoors(
xyTuple: [number, number],
): { x: number; y: number } {
const [x, y] = xyTuple;
return { x, y };
}