-
Notifications
You must be signed in to change notification settings - Fork 89
ultra fast scrolling when using touchpad. #333
Comments
The same behaviour can also be seen when scrolling to adjust the volume/amplification. I tried to fix this issue. |
|
I just tried different multipliers and this one felt right. Though, I think the original scrolling distance would be achieved when using 1 as multiplier. But I am not sure. |
Is it adjusted for your touchpad then? |
No, I have a normal laptop using arch linux with plasma 5. |
Can you do me a favor? If this provide proper value for you, it would be better use this value to calculate velocity instead of disabling animation.
This will print wheel.pixelDelta.y into stdout. |
Also, there's a property so-called |
Here is the output of the log of pixelDelta, i also logged angleDelta for comparison: console.log("pixelDelta: ", wheel.pixelDelta.y, ", angleDelta: ", wheel.angleDelta.y) |
I tried some values and 2000 is somewhat usable, but it feels very unresponsive compared to the method I used in my patch
I already wanted to set the velocity instead of Also, I dont know how to test if the "Invert direction of mouse wheel scroll" in QML to implement that correctly. |
Can you test this patch? diff --git a/src/bomi/imports/bomi/ModelView.qml b/src/bomi/imports/bomi/ModelView.qml
index f4c324a..34621a7 100644
--- a/src/bomi/imports/bomi/ModelView.qml
+++ b/src/bomi/imports/bomi/ModelView.qml
@@ -292,7 +292,41 @@ Item {
}
}
+ property real tsWheel: -1
+
+ function calcVelocity(angle, pixel, smooth, pos, min, max, dt) {
+ var v = 0
+ if (pixel != 0)
+ v = pixel / dt
+ else
+ v = angle
+ if (v > 0 && pos > min) {
+ if (v == Number.POSITIVE_INFINITY)
+ v = 0
+ return Math.max(v - smooth, maximumFlickVelocity / 4)
+ } else if (v < 0 && pos < max) {
+ if (v == Number.NEGATIVE_INFINITY)
+ v = 0
+ return Math.min(v - smooth, -maximumFlickVelocity / 4)
+ }
+ return 0
+ }
+
+ function wheelScroll(angle, pixel) {
+ if (tsWheel < 0)
+ tsWheel = new Date().getTime() / 1000
+ var current = new Date().getTime() / 1000
+ var dt = current - tsWheel
+ var vx = calcVelocity(angle.x, pixel.x, horizontalVelocity, contentX,
+ 0, contentWidth - list.width, dt)
+ var vy = calcVelocity(angle.y, pixel.y, verticalVelocity, contentY,
+ -headerItem.height, contentHeight - list.height - footerItem.height, dt)
+ flick(vx, vy)
+ tsWheel = current
+ }
+
MouseArea {
+ id: mouseArea
z: -1
anchors.fill: parent
onPressed: {
@@ -305,6 +339,7 @@ Item {
if (index !== -1)
view.activated(index)
}
+ onWheel: list.wheelScroll(wheel.angleDelta, wheel.pixelDelta)
}
|
Also, try this one, too: diff --git a/src/bomi/imports/bomi/ModelView.qml b/src/bomi/imports/bomi/ModelView.qml
index f4c324a..f2b1693 100644
--- a/src/bomi/imports/bomi/ModelView.qml
+++ b/src/bomi/imports/bomi/ModelView.qml
@@ -291,6 +291,28 @@ Item {
positionViewAtIndex(idx, ListView.Visible)
}
}
+ function calcVelocity(angle, smooth, pos, min, max) {
+ var v = angle
+ if (v > 0 && pos > min)
+ return Math.max(v - smooth, maximumFlickVelocity / 4)
+ else if (v < 0 && pos < max)
+ return Math.min(v - smooth, -maximumFlickVelocity / 4)
+ return 0
+ }
+
+ function wheelScroll(angle, pixel) {
+ if (pixel.x != 0 || pixel.y != 0) {
+ contentX -= pixel.x
+ contentY -= pixel.y
+ returnToBounds()
+ } else {
+ var vx = calcVelocity(angle.x, horizontalVelocity, contentX,
+ 0, contentWidth - list.width)
+ var vy = calcVelocity(angle.y, verticalVelocity, contentY,
+ -headerItem.height, contentHeight - list.height - footerItem.height)
+ flick(vx, vy)
+ }
+ }
MouseArea {
z: -1
@@ -305,6 +327,7 @@ Item {
if (index !== -1)
view.activated(index)
}
+ onWheel: list.wheelScroll(wheel.angleDelta, wheel.pixelDelta)
}
And which one do you think is better? |
The first one is still too fast in my opinion. |
Fixed. Thank you! |
In the playback history and the playlist, scrolling is way too fast when I use my touchpad.
When I use my mouse it's working normally.
Touchpad-scrolling is working normally in other applications.
The text was updated successfully, but these errors were encountered: