[gnome-shell/wip/exalm/swipe-unaccel] swipeTracker: Use unaccelerated deltas
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/swipe-unaccel] swipeTracker: Use unaccelerated deltas
- Date: Fri, 16 Jul 2021 20:30:22 +0000 (UTC)
commit b156cabdc9acbb62a93abce2cf4dc9b081c995b5
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sun Feb 28 18:59:31 2021 +0500
swipeTracker: Use unaccelerated deltas
Unaccelerated deltas make sure the gesture works the same regardless of how
fast the fingers move; this is what we were already doing for scrolling.
Remove the swipe multiplier as the deltas already match scrolling other than
the 1/10 multiplier Clutter applies to scrolling specifically.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1763>
js/ui/swipeTracker.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index f5f4dbb800..4546b76b61 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -16,7 +16,6 @@ const TOUCHPAD_BASE_WIDTH = 400;
const EVENT_HISTORY_THRESHOLD_MS = 150;
const SCROLL_MULTIPLIER = 10;
-const SWIPE_MULTIPLIER = 0.5;
const MIN_ANIMATION_DURATION = 100;
const MAX_ANIMATION_DURATION = 400;
@@ -139,7 +138,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
let time = event.get_time();
const [x, y] = event.get_coords();
- let [dx, dy] = event.get_gesture_motion_delta();
+ const [dx, dy] = event.get_gesture_motion_delta_unaccelerated();
if (this._state === TouchpadState.NONE) {
if (dx === 0 && dy === 0)
@@ -151,8 +150,8 @@ const TouchpadSwipeGesture = GObject.registerClass({
}
if (this._state === TouchpadState.PENDING) {
- this._cumulativeX += dx * SWIPE_MULTIPLIER;
- this._cumulativeY += dy * SWIPE_MULTIPLIER;
+ this._cumulativeX += dx;
+ this._cumulativeY += dy;
const cdx = this._cumulativeX;
const cdy = this._cumulativeY;
@@ -179,7 +178,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
}
const vertical = this.orientation === Clutter.Orientation.VERTICAL;
- let delta = (vertical ? dy : dx) * SWIPE_MULTIPLIER;
+ let delta = vertical ? dy : dx;
const distance = vertical ? TOUCHPAD_BASE_HEIGHT : TOUCHPAD_BASE_WIDTH;
switch (event.get_gesture_phase()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]