mirror of
https://github.com/zen-browser/desktop.git
synced 2026-09-02 11:43:35 +00:00
50 lines
2.2 KiB
C++
50 lines
2.2 KiB
C++
diff --git a/widget/SwipeTracker.cpp b/widget/SwipeTracker.cpp
|
|
index 83b80a808261ce28e5c571dc802993556477f0c8..8de39d5c724e23f540a70f47e893e46bcf1112e6 100644
|
|
--- a/widget/SwipeTracker.cpp
|
|
+++ b/widget/SwipeTracker.cpp
|
|
@@ -10,6 +10,7 @@
|
|
#include "mozilla/PresShell.h"
|
|
#include "mozilla/StaticPrefs_browser.h"
|
|
#include "mozilla/StaticPrefs_widget.h"
|
|
+#include "mozilla/StaticPrefs_zen.h"
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "mozilla/TouchEvents.h"
|
|
#include "mozilla/dom/SimpleGestureEventBinding.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 =
|
|
@@ -84,13 +88,14 @@ bool SwipeTracker::ComputeSwipeSuccess() const {
|
|
// If the fingers were moving away from the target direction when they were
|
|
// lifted from the touchpad, abort the swipe.
|
|
if (mCurrentVelocity * targetValue <
|
|
- -StaticPrefs::widget_swipe_velocity_twitch_tolerance()) {
|
|
+ -StaticPrefs::widget_swipe_velocity_twitch_tolerance()
|
|
+ && !StaticPrefs::zen_swipe_is_fast_swipe()) {
|
|
return false;
|
|
}
|
|
|
|
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 +146,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;
|