Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #12434 from brave/issue-9615
Browse files Browse the repository at this point in the history
Use different distance thresholds for axis X and Y
  • Loading branch information
bsclifton committed Dec 29, 2017
1 parent 7cce568 commit fef1a4a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/renderer/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ class Main extends React.Component {
if (trackingFingers) {
deltaX = deltaX + e.deltaX
deltaY = deltaY + e.deltaY
const distanceThreshold = getSetting(settings.SWIPE_NAV_DISTANCE)
const percent = Math.abs(deltaX) / distanceThreshold
const distanceThresholdX = getSetting(settings.SWIPE_NAV_DISTANCE)
const percent = Math.abs(deltaX) / distanceThresholdX
if (isSwipeOnRightEdge) {
if (percent > 1) {
appActions.swipedRight(1)
Expand All @@ -249,12 +249,13 @@ class Main extends React.Component {
}, { passive: true })

ipc.on('scroll-touch-end', () => {
const distanceThreshold = getSetting(settings.SWIPE_NAV_DISTANCE)
const distanceThresholdX = getSetting(settings.SWIPE_NAV_DISTANCE)
const distanceThresholdY = 101
const timeThreshold = 80
if (trackingFingers && time > timeThreshold && Math.abs(deltaY) < distanceThreshold) {
if (deltaX > distanceThreshold && isSwipeOnRightEdge) {
if (trackingFingers && time > timeThreshold && Math.abs(deltaY) < distanceThresholdY) {
if (deltaX > distanceThresholdX && isSwipeOnRightEdge) {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_FORWARD)
} else if (deltaX < -distanceThreshold && isSwipeOnLeftEdge) {
} else if (deltaX < -distanceThresholdX && isSwipeOnLeftEdge) {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_BACK)
}
}
Expand Down

0 comments on commit fef1a4a

Please sign in to comment.