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

Apply two fingers swiper changes to 901d5dba082a5e5d5213d726337a532b95b269d6 #8642

Merged
merged 1 commit into from
May 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Main extends ImmutableComponent {

registerSwipeListener () {
// Navigates back/forward on macOS two- and or three-finger swipe
let swipeGesture = false
let mouseInFrame = false
let trackingFingers = false
let startTime = 0
let isSwipeOnLeftEdge = false
Expand All @@ -223,17 +223,10 @@ class Main extends ImmutableComponent {
let deltaY = 0
let time

ipc.on(messages.ENABLE_SWIPE_GESTURE, (e) => {
swipeGesture = true
})

ipc.on(messages.DISABLE_SWIPE_GESTURE, (e) => {
swipeGesture = false
})

// isSwipeTrackingFromScrollEventsEnabled is only true if "two finger scroll to swipe" is enabled
ipc.on('scroll-touch-begin', () => {
if (swipeGesture) {
mouseInFrame = this.props.windowState.getIn(['ui', 'mouseInFrame'])
if (mouseInFrame) {
trackingFingers = true
startTime = (new Date()).getTime()
}
Expand Down Expand Up @@ -278,7 +271,7 @@ class Main extends ImmutableComponent {
})

const throttledSwipe = _.throttle(direction => {
if (swipeGesture) {
if (mouseInFrame) {
if (direction === 'left') {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_BACK)
} else if (direction === 'right') {
Expand Down