Refactoring in pointer down event handler, step 3 (#1888)

* Refactor: use pointer down state for alt duplication flag

* Refactor: use pointer down state for drag state

* Refactor: simplify over scrollbars check

* Refactor: move pointer move handler out of pointer down handler

* Refactor: move pointer up handler out of pointer down handler

* Refactor: further simplify scrollbar check state in pointer down event

* Refactor: pull out initial pointer down state creation
This commit is contained in:
Michal Srb 2020-07-09 14:15:42 -07:00 committed by GitHub
parent 6e357c0291
commit 4ab4fce998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 587 additions and 550 deletions

File diff suppressed because it is too large Load Diff

View File

@ -107,10 +107,11 @@ export const isOverScrollBars = (
x: number,
y: number,
): {
isOverHorizontalScrollBar: boolean;
isOverVerticalScrollBar: boolean;
isOverEither: boolean;
isOverHorizontal: boolean;
isOverVertical: boolean;
} => {
const [isOverHorizontalScrollBar, isOverVerticalScrollBar] = [
const [isOverHorizontal, isOverVertical] = [
scrollBars.horizontal,
scrollBars.vertical,
].map((scrollBar) => {
@ -122,9 +123,6 @@ export const isOverScrollBars = (
y <= scrollBar.y + scrollBar.height
);
});
return {
isOverHorizontalScrollBar,
isOverVerticalScrollBar,
};
const isOverEither = isOverHorizontal || isOverVertical;
return { isOverEither, isOverHorizontal, isOverVertical };
};