Refactoring in pointer down event handler (#1880)

* Refactor: Move context menu touch device handling

* Refactor: Move more stuff out of pointer down

* Refactor: Move last coords into an object

* Refactor: Move scrollbar handling out of pointer down

* Refactor: simplify resizing in pointer down

* Refactor: further simplify resizing in pointer down

* Refactor: clarify clearing selection code

* Refactor: move out clearing selection from pointer down

* Refactor: further simplify deselection in pointer down
This commit is contained in:
Michal Srb 2020-07-08 22:07:51 -07:00 committed by GitHub
parent d5e7d08586
commit 5d7020cce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 278 additions and 226 deletions

View file

@ -106,13 +106,16 @@ export const isOverScrollBars = (
scrollBars: ScrollBars,
x: number,
y: number,
) => {
): {
isOverHorizontalScrollBar: boolean;
isOverVerticalScrollBar: boolean;
} => {
const [isOverHorizontalScrollBar, isOverVerticalScrollBar] = [
scrollBars.horizontal,
scrollBars.vertical,
].map((scrollBar) => {
return (
scrollBar &&
scrollBar != null &&
scrollBar.x <= x &&
x <= scrollBar.x + scrollBar.width &&
scrollBar.y <= y &&