|
1 | 1 | var webviews = require('webviews.js') |
| 2 | +var settings = require('util/settings/settings.js') |
2 | 3 |
|
3 | 4 | var webviewGestures = { |
4 | 5 | showBackArrow: function () { |
@@ -93,24 +94,27 @@ function onSwipeGestureLowVelocity () { |
93 | 94 | } |
94 | 95 |
|
95 | 96 | webviews.callAsync(tabs.getSelected(), 'getZoomFactor', function(err, result) { |
96 | | - const minScrollDistance = 150 * result; |
| 97 | + const isTrackpadGesturesEnabled = !settings.get('disableGoBackwardAndGoForwardGestures') |
97 | 98 |
|
| 99 | + if (isTrackpadGesturesEnabled) { |
| 100 | + const minScrollDistance = 150 * result; |
98 | 101 | if ((leftMouseMove / rightMouseMove > 5) || (rightMouseMove / leftMouseMove > 5)) { |
99 | | - // swipe to the left to go forward |
100 | | - if (leftMouseMove - beginningScrollRight > minScrollDistance && Math.abs(horizontalMouseMove / verticalMouseMove) > 3) { |
101 | | - if (beginningScrollRight < 5) { |
102 | | - resetDistanceCounters() |
103 | | - resetScrollCounters() |
104 | | - webviews.callAsync(tabs.getSelected(), 'goForward') |
| 102 | + // swipe to the left to go forward |
| 103 | + if (leftMouseMove - beginningScrollRight > minScrollDistance && Math.abs(horizontalMouseMove / verticalMouseMove) > 3) { |
| 104 | + if (beginningScrollRight < 5) { |
| 105 | + resetDistanceCounters() |
| 106 | + resetScrollCounters() |
| 107 | + webviews.callAsync(tabs.getSelected(), 'goForward') |
| 108 | + } |
105 | 109 | } |
106 | | - } |
107 | 110 |
|
108 | | - // swipe to the right to go backwards |
109 | | - if (rightMouseMove + beginningScrollLeft > minScrollDistance && Math.abs(horizontalMouseMove / verticalMouseMove) > 3) { |
110 | | - if (beginningScrollLeft < 5) { |
111 | | - resetDistanceCounters() |
112 | | - resetScrollCounters() |
113 | | - webviews.goBackIgnoringRedirects(tabs.getSelected()) |
| 111 | + // swipe to the right to go backwards |
| 112 | + if (rightMouseMove + beginningScrollLeft > minScrollDistance && Math.abs(horizontalMouseMove / verticalMouseMove) > 3) { |
| 113 | + if (beginningScrollLeft < 5) { |
| 114 | + resetDistanceCounters() |
| 115 | + resetScrollCounters() |
| 116 | + webviews.goBackIgnoringRedirects(tabs.getSelected()) |
| 117 | + } |
114 | 118 | } |
115 | 119 | } |
116 | 120 | } |
|
0 commit comments