-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for gesture zone in
TraceGesture
too (#2617)
- Loading branch information
Showing
3 changed files
with
24 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import viewportStore from '../stores/viewport' | ||
|
||
const TOOLBAR_HEIGHT = 50 | ||
|
||
/** Returns true if the pointer is in the gesture zone. To the right for righties, to the left for lefties. */ | ||
const isInGestureZone = (x: number, y: number, leftHanded: boolean) => { | ||
const viewport = viewportStore.getState() | ||
const scrollZoneWidth = viewport.scrollZoneWidth | ||
const isInGestureZone = | ||
(leftHanded ? x > scrollZoneWidth : x < viewport.innerWidth - scrollZoneWidth) && y > TOOLBAR_HEIGHT | ||
return isInGestureZone | ||
} | ||
|
||
export default isInGestureZone |