From 6f68f35810d0327cd087b4748eecea655fd7bbf8 Mon Sep 17 00:00:00 2001 From: vslg Date: Wed, 20 May 2020 23:03:36 -0300 Subject: [PATCH] Fix goal is disabling kinetic scrolling --- src/backend/user_files.py | 2 +- src/gui/Base/HFlickableColumnPage.qml | 2 +- src/gui/Base/HGridView.qml | 2 +- ...kpadFix.qml => HKineticScrollingDisabler.qml} | 16 ++++++---------- src/gui/Base/HListView.qml | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) rename src/gui/Base/{HTrackpadFix.qml => HKineticScrollingDisabler.qml} (78%) diff --git a/src/backend/user_files.py b/src/backend/user_files.py index 5769a96e..20425f32 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -235,13 +235,13 @@ class UISettings(JSONDataFile): "clearRoomFilterOnEscape": True, "clearMemberFilterOnEscape": True, "collapseSidePanesUnderWindowWidth": 400, + "enableKineticScrolling": True, "hideProfileChangeEvents": True, "hideMembershipEvents": False, "hideUnknownEvents": False, "maxMessageCharactersPerLine": 65, "ownMessagesOnLeftAboveWidth": 895, "theme": "Midnight.qpl", - "useTrackpadFix": False, "writeAliases": {}, "media": { "autoLoad": True, diff --git a/src/gui/Base/HFlickableColumnPage.qml b/src/gui/Base/HFlickableColumnPage.qml index 093153ca..027281d7 100644 --- a/src/gui/Base/HFlickableColumnPage.qml +++ b/src/gui/Base/HFlickableColumnPage.qml @@ -27,7 +27,7 @@ HPage { } } - HTrackpadFix { + HKineticScrollingDisabler { flickable: flickable anchors.fill: flickable } diff --git a/src/gui/Base/HGridView.qml b/src/gui/Base/HGridView.qml index f59f88d3..79bdc3d0 100644 --- a/src/gui/Base/HGridView.qml +++ b/src/gui/Base/HGridView.qml @@ -117,7 +117,7 @@ GridView { } - HTrackpadFix { + HKineticScrollingDisabler { id: mouseArea anchors.fill: parent } diff --git a/src/gui/Base/HTrackpadFix.qml b/src/gui/Base/HKineticScrollingDisabler.qml similarity index 78% rename from src/gui/Base/HTrackpadFix.qml rename to src/gui/Base/HKineticScrollingDisabler.qml index 507e7155..b0a49ea0 100644 --- a/src/gui/Base/HTrackpadFix.qml +++ b/src/gui/Base/HKineticScrollingDisabler.qml @@ -2,10 +2,10 @@ import QtQuick 2.12 -// MouseArea component to fix scroll on trackpad +// MouseArea component to disable kinetic scrolling MouseArea { id: mouseArea - enabled: window.settings.useTrackpadFix + enabled: ! window.settings.enableKineticScrolling propagateComposedEvents: true acceptedButtons: Qt.NoButton @@ -21,7 +21,6 @@ MouseArea { property Flickable flickable: parent - property int scrollFactor: 5 // Used to get default flickDeceleration value readonly property Flickable dummy: Flickable {} @@ -33,11 +32,8 @@ MouseArea { // low resolution trackpads. // When higher pixelDelta, more scroll will be applied const pixelDelta = - wheel.pixelDelta.y * scrollFactor || - wheel.angleDelta.y / - 24 * - Qt.styleHints.wheelScrollLines * - scrollFactor + wheel.pixelDelta.y || + wheel.angleDelta.y / 8 * Qt.styleHints.wheelScrollLines // Return current position if there was not any movement if (flickable.contentHeight < flickable.height || !pixelDelta) @@ -61,12 +57,12 @@ MouseArea { Binding { target: flickable property: "maximumFlickVelocity" - value: mouseArea.enabled ? scrollFactor : 4000.0 + value: mouseArea.enabled ? 0 : 4000.0 } Binding { target: flickable property: "flickDeceleration" - value: mouseArea.enabled ? scrollFactor * 3 : dummy.flickDeceleration + value: mouseArea.enabled ? 0 : dummy.flickDeceleration } } diff --git a/src/gui/Base/HListView.qml b/src/gui/Base/HListView.qml index a5c65ee3..82391d64 100644 --- a/src/gui/Base/HListView.qml +++ b/src/gui/Base/HListView.qml @@ -118,7 +118,7 @@ ListView { } - HTrackpadFix { + HKineticScrollingDisabler { id: mouseArea anchors.fill: parent }