Fix goal is disabling kinetic scrolling

This commit is contained in:
vslg 2020-05-20 23:03:36 -03:00
parent 1bad1e1106
commit 6f68f35810
5 changed files with 10 additions and 14 deletions

View File

@ -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,

View File

@ -27,7 +27,7 @@ HPage {
}
}
HTrackpadFix {
HKineticScrollingDisabler {
flickable: flickable
anchors.fill: flickable
}

View File

@ -117,7 +117,7 @@ GridView {
}
HTrackpadFix {
HKineticScrollingDisabler {
id: mouseArea
anchors.fill: parent
}

View File

@ -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
}
}

View File

@ -118,7 +118,7 @@ ListView {
}
HTrackpadFix {
HKineticScrollingDisabler {
id: mouseArea
anchors.fill: parent
}