mirror of
https://github.com/zen-browser/desktop.git
synced 2026-05-28 07:45:09 +00:00
42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
diff --git a/widget/SwipeTracker.cpp b/widget/SwipeTracker.cpp
|
|
index 887d06d3bd9cdaa934880e0ae7a11ec8b737fb61..7225d4264c9ec71ef1e5e717a1a62c4ef0aff0b7 100644
|
|
--- a/widget/SwipeTracker.cpp
|
|
+++ b/widget/SwipeTracker.cpp
|
|
@@ -3,6 +3,7 @@
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "SwipeTracker.h"
|
|
+#include "mozilla/StaticPrefs_zen.h"
|
|
|
|
#include "InputData.h"
|
|
#include "mozilla/FlushType.h"
|
|
@@ -67,6 +68,9 @@ double SwipeTracker::SwipeSuccessTargetValue() const {
|
|
}
|
|
|
|
double SwipeTracker::ClampToAllowedRange(double aGestureAmount) const {
|
|
+ if (StaticPrefs::zen_swipe_is_fast_swipe()) {
|
|
+ return aGestureAmount;
|
|
+ }
|
|
// gestureAmount needs to stay between -1 and 0 when swiping right and
|
|
// between 0 and 1 when swiping left.
|
|
double min =
|
|
@@ -90,7 +94,7 @@ bool SwipeTracker::ComputeSwipeSuccess() const {
|
|
|
|
return (mGestureAmount * targetValue +
|
|
mCurrentVelocity * targetValue *
|
|
- StaticPrefs::widget_swipe_success_velocity_contribution()) >=
|
|
+ (StaticPrefs::zen_swipe_is_fast_swipe() ? 0.5 : StaticPrefs::widget_swipe_success_velocity_contribution())) >=
|
|
kSwipeSuccessThreshold;
|
|
}
|
|
|
|
@@ -141,7 +145,8 @@ nsEventStatus SwipeTracker::ProcessEvent(
|
|
// display the UI as if we were at the success threshold as that would
|
|
// give a false indication that navigation would happen.
|
|
if (!computedSwipeSuccess && (eventAmount >= kSwipeSuccessThreshold ||
|
|
- eventAmount <= -kSwipeSuccessThreshold)) {
|
|
+ eventAmount <= -kSwipeSuccessThreshold)
|
|
+ && !StaticPrefs::zen_swipe_is_fast_swipe()) {
|
|
eventAmount = 0.999 * kSwipeSuccessThreshold;
|
|
if (mGestureAmount < 0.f) {
|
|
eventAmount = -eventAmount;
|