From efda3a419e0ba15076c05fd6306c6e2bcc53743a Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 14 Jul 2020 05:46:48 -0400 Subject: [PATCH] Add kineticScrollingDeceleration setting --- src/backend/user_files.py | 1 + src/gui/Base/HFlickable.qml | 1 + src/gui/Base/HGridView.qml | 1 + src/gui/Base/HKineticScrollingDisabler.qml | 8 ++++---- src/gui/Base/HListView.qml | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backend/user_files.py b/src/backend/user_files.py index ae5690e9..411fa769 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -267,6 +267,7 @@ class UISettings(JSONDataFile): "hideMembershipEvents": False, "hideUnknownEvents": True, "kineticScrollingMaxSpeed": 2500, + "kineticScrollingDeceleration": 1500, "markRoomReadMsecDelay": 200, "maxMessageCharactersPerLine": 65, "ownMessagesOnLeftAboveWidth": 895, diff --git a/src/gui/Base/HFlickable.qml b/src/gui/Base/HFlickable.qml index 483f2259..42f002d5 100644 --- a/src/gui/Base/HFlickable.qml +++ b/src/gui/Base/HFlickable.qml @@ -5,6 +5,7 @@ import QtQuick.Controls 2.12 Flickable { maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed + flickDeceleration: window.settings.kineticScrollingDeceleration ScrollBar.vertical: HScrollBar { visible: parent.interactive diff --git a/src/gui/Base/HGridView.qml b/src/gui/Base/HGridView.qml index a915734a..f61ff7d5 100644 --- a/src/gui/Base/HGridView.qml +++ b/src/gui/Base/HGridView.qml @@ -75,6 +75,7 @@ GridView { preferredHighlightEnd: height / 2 + currentItemHeight / 2 maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed + flickDeceleration: window.settings.kineticScrollingDeceleration highlight: Rectangle { diff --git a/src/gui/Base/HKineticScrollingDisabler.qml b/src/gui/Base/HKineticScrollingDisabler.qml index 7352104f..07c1055d 100644 --- a/src/gui/Base/HKineticScrollingDisabler.qml +++ b/src/gui/Base/HKineticScrollingDisabler.qml @@ -7,9 +7,6 @@ MouseArea { property Flickable flickable: parent - // Used to get default flickDeceleration value - readonly property Flickable dummy: Flickable {} - function getNewPosition(flickable, wheel) { // wheel.pixelDelta will be available on high resolution trackpads. // Otherwise use wheel.angleDelta, which is available from mouses and @@ -60,6 +57,9 @@ MouseArea { Binding { target: flickable property: "flickDeceleration" - value: mouseArea.enabled ? 0 : dummy.flickDeceleration + value: + mouseArea.enabled ? + 0 : + window.settings.kineticScrollingDeceleration } } diff --git a/src/gui/Base/HListView.qml b/src/gui/Base/HListView.qml index 0082c304..a4ff865a 100644 --- a/src/gui/Base/HListView.qml +++ b/src/gui/Base/HListView.qml @@ -87,7 +87,7 @@ ListView { preferredHighlightEnd: height / 2 + currentItemHeight / 2 maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed - + flickDeceleration: window.settings.kineticScrollingDeceleration highlight: Rectangle { color: theme.controls.listView.highlight