Browse Source

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
Michal Srb 5 years ago
parent
commit
4ab4fce998
2 changed files with 537 additions and 636 deletions
  1. 531 628
      src/components/App.tsx
  2. 6 8
      src/scene/scrollbars.ts

File diff suppressed because it is too large
+ 531 - 628
src/components/App.tsx


+ 6 - 8
src/scene/scrollbars.ts

@@ -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 };
 };

Some files were not shown because too many files changed in this diff