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

Supersede cd3dd7829731f6e36eb70ac1ac4397598e615153 by "scroll-touch-edge" #4369

Merged
merged 1 commit into from
Oct 4, 2016
Merged
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions app/extensions/brave/content/scripts/inputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,3 @@ document.addEventListener('keydown', (e /*: Event*/) => {
break
}
})

chrome.ipc.on('check-swipe-back', (e) => {
if (document.scrollingElement.scrollLeft === 0) {
chrome.ipc.sendToHost('can-swipe-back')
}
})

chrome.ipc.on('check-swipe-forward', (e) => {
const scrollEle = document.scrollingElement
if (scrollEle.scrollLeft === 0 ||
scrollEle.scrollLeft === (scrollEle.scrollWidth - scrollEle.clientWidth)) {
chrome.ipc.sendToHost('can-swipe-forward')
}
})
15 changes: 0 additions & 15 deletions js/actions/webviewActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ const webviewActions = {
}
},

/**
* Check two-finger gesture swipe back/forward ability
* @param {bool} back - true for back, false for forward
*/
checkSwipe: function (back) {
const webview = getWebview()
if (webview) {
if (back) {
webview.send(messages.CHECK_SWIPE_BACK)
} else {
webview.send(messages.CHECK_SWIPE_FORWARD)
}
}
},

/**
* Set/unset webkit fullscreen status
* @param {Boolean} isFullScreen - fullscreen state to go to
Expand Down
6 changes: 0 additions & 6 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,6 @@ class Frame extends ImmutableComponent {
}
}
break
case messages.CAN_SWIPE_BACK:
currentWindow.webContents.send(messages.CAN_SWIPE_BACK)
break
case messages.CAN_SWIPE_FORWARD:
currentWindow.webContents.send(messages.CAN_SWIPE_FORWARD)
break
case messages.CLEAR_BROWSING_DATA_NOW:
method = (clearBrowsingDataDetail) =>
windowActions.setClearBrowsingDataDetail(clearBrowsingDataDetail)
Expand Down
19 changes: 2 additions & 17 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ class Main extends ImmutableComponent {
// Navigates back/forward on macOS two-finger swipe
var trackingFingers = false
var swipeGesture = false
var canSwipeBack = false
var canSwipeForward = false
var isSwipeOnEdge = false
var deltaX = 0
var deltaY = 0
Expand All @@ -200,11 +198,6 @@ class Main extends ImmutableComponent {
deltaX = deltaX + e.deltaX
deltaY = deltaY + e.deltaY
time = (new Date()).getTime() - startTime
if (deltaX > 0) {
webviewActions.checkSwipe(false)
} else if (deltaX < 0) {
webviewActions.checkSwipe(true)
}
}
})
ipc.on(messages.DEBUG_REACT_PROFILE, (e, args) => {
Expand Down Expand Up @@ -233,12 +226,6 @@ class Main extends ImmutableComponent {
}, true)
}
})
ipc.on(messages.CAN_SWIPE_BACK, (e) => {
canSwipeBack = true
})
ipc.on(messages.CAN_SWIPE_FORWARD, (e) => {
canSwipeForward = true
})
ipc.on(messages.ENABLE_SWIPE_GESTURE, (e) => {
swipeGesture = true
})
Expand All @@ -255,15 +242,13 @@ class Main extends ImmutableComponent {
})
ipc.on('scroll-touch-end', function () {
if (time > 50 && trackingFingers && Math.abs(deltaY) < 50 && isSwipeOnEdge) {
if (deltaX > 70 && canSwipeForward) {
if (deltaX > 70) {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_FORWARD)
} else if (deltaX < -70 && canSwipeBack) {
} else if (deltaX < -70) {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_BACK)
}
}
trackingFingers = false
canSwipeBack = false
canSwipeForward = false
deltaX = 0
deltaY = 0
startTime = 0
Expand Down
4 changes: 0 additions & 4 deletions js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ const messages = {
GO_BACK: _,
GO_FORWARD: _,
RELOAD: _,
CAN_SWIPE_BACK: _,
CAN_SWIPE_FORWARD: _,
CHECK_SWIPE_BACK: _,
CHECK_SWIPE_FORWARD: _,
ENABLE_SWIPE_GESTURE: _,
DISABLE_SWIPE_GESTURE: _,
SHOW_FLASH_NOTIFICATION: _,
Expand Down