mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1753146 - Add preferences for tweaking swipe gestures. r=tnikkel
And use 2x threshold value to trigger each SwipeGesture for Windows. Differential Revision: https://phabricator.services.mozilla.com/D138237
This commit is contained in:
parent
955ca926b3
commit
554dfc9c32
@ -12861,6 +12861,26 @@
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
# Various metrics to control SwipeTracker.
|
||||
- name: widget.swipe.velocity-twitch-tolerance
|
||||
type: float
|
||||
value: 0.0000001f
|
||||
mirror: always
|
||||
|
||||
- name: widget.swipe.success-threshold
|
||||
type: float
|
||||
#if defined(XP_WIN)
|
||||
value: 0.5f
|
||||
#else
|
||||
value: 0.25f
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
- name: widget.swipe.success-velocity-contribution
|
||||
type: float
|
||||
value: 0.05f
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "xul."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -21,10 +21,7 @@
|
||||
// These values were tweaked to make the physics feel similar to the native
|
||||
// swipe.
|
||||
static const double kSpringForce = 250.0;
|
||||
static const double kVelocityTwitchTolerance = 0.0000001;
|
||||
static const double kWholePagePixelSize = 550.0;
|
||||
static const double kSwipeSuccessThreshold = 0.25;
|
||||
static const double kSwipeSuccessVelocityContribution = 0.05;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -93,13 +90,16 @@ 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 < -kVelocityTwitchTolerance) {
|
||||
if (mCurrentVelocity * targetValue <
|
||||
-StaticPrefs::widget_swipe_velocity_twitch_tolerance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (mGestureAmount * targetValue +
|
||||
mCurrentVelocity * targetValue * kSwipeSuccessVelocityContribution) >=
|
||||
kSwipeSuccessThreshold;
|
||||
mCurrentVelocity * targetValue *
|
||||
StaticPrefs::widget_swipe_success_velocity_contribution()) >=
|
||||
|
||||
StaticPrefs::widget_swipe_success_threshold();
|
||||
}
|
||||
|
||||
nsEventStatus SwipeTracker::ProcessEvent(const PanGestureInput& aEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user