Add kineticScrollingDeceleration setting

This commit is contained in:
miruka 2020-07-14 05:46:48 -04:00
parent 8b11ddd5b5
commit efda3a419e
5 changed files with 8 additions and 5 deletions

View File

@ -267,6 +267,7 @@ class UISettings(JSONDataFile):
"hideMembershipEvents": False, "hideMembershipEvents": False,
"hideUnknownEvents": True, "hideUnknownEvents": True,
"kineticScrollingMaxSpeed": 2500, "kineticScrollingMaxSpeed": 2500,
"kineticScrollingDeceleration": 1500,
"markRoomReadMsecDelay": 200, "markRoomReadMsecDelay": 200,
"maxMessageCharactersPerLine": 65, "maxMessageCharactersPerLine": 65,
"ownMessagesOnLeftAboveWidth": 895, "ownMessagesOnLeftAboveWidth": 895,

View File

@ -5,6 +5,7 @@ import QtQuick.Controls 2.12
Flickable { Flickable {
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
ScrollBar.vertical: HScrollBar { ScrollBar.vertical: HScrollBar {
visible: parent.interactive visible: parent.interactive

View File

@ -75,6 +75,7 @@ GridView {
preferredHighlightEnd: height / 2 + currentItemHeight / 2 preferredHighlightEnd: height / 2 + currentItemHeight / 2
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
highlight: Rectangle { highlight: Rectangle {

View File

@ -7,9 +7,6 @@ MouseArea {
property Flickable flickable: parent property Flickable flickable: parent
// Used to get default flickDeceleration value
readonly property Flickable dummy: Flickable {}
function getNewPosition(flickable, wheel) { function getNewPosition(flickable, wheel) {
// wheel.pixelDelta will be available on high resolution trackpads. // wheel.pixelDelta will be available on high resolution trackpads.
// Otherwise use wheel.angleDelta, which is available from mouses and // Otherwise use wheel.angleDelta, which is available from mouses and
@ -60,6 +57,9 @@ MouseArea {
Binding { Binding {
target: flickable target: flickable
property: "flickDeceleration" property: "flickDeceleration"
value: mouseArea.enabled ? 0 : dummy.flickDeceleration value:
mouseArea.enabled ?
0 :
window.settings.kineticScrollingDeceleration
} }
} }

View File

@ -87,7 +87,7 @@ ListView {
preferredHighlightEnd: height / 2 + currentItemHeight / 2 preferredHighlightEnd: height / 2 + currentItemHeight / 2
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
highlight: Rectangle { highlight: Rectangle {
color: theme.controls.listView.highlight color: theme.controls.listView.highlight