mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
fix(touchpad): differentiate scroll speed between touchpad and mouse wheel
This commit is contained in:
@@ -1,6 +1,24 @@
|
||||
import QtQuick
|
||||
|
||||
Flickable {
|
||||
id: root
|
||||
maximumFlickVelocity: 3500
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
property real touchpadScrollFactor: 100
|
||||
property real mouseScrollFactor: 50
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
onWheel: function(wheelEvent) {
|
||||
var delta = wheelEvent.angleDelta.y / 120;
|
||||
// The angleDelta.y of a touchpad is usually small and continuous,
|
||||
// while that of a mouse wheel is typically in multiples of ±120.
|
||||
var scrollFactor = Math.abs(wheelEvent.angleDelta.y) >= 120 ? root.mouseScrollFactor : root.touchpadScrollFactor;
|
||||
var targetY = root.contentY - delta * scrollFactor;
|
||||
targetY = Math.max(0, Math.min(targetY, root.contentHeight - root.height));
|
||||
root.contentY = targetY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ ListView {
|
||||
property real dragDistance: 0
|
||||
property bool popin: true
|
||||
|
||||
property real touchpadScrollFactor: 100
|
||||
property real mouseScrollFactor: 50
|
||||
|
||||
function resetDrag() {
|
||||
root.dragIndex = -1
|
||||
root.dragDistance = 0
|
||||
@@ -23,6 +26,20 @@ ListView {
|
||||
maximumFlickVelocity: 3500
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
onWheel: function(wheelEvent) {
|
||||
var delta = wheelEvent.angleDelta.y / 120;
|
||||
// The angleDelta.y of a touchpad is usually small and continuous,
|
||||
// while that of a mouse wheel is typically in multiples of ±120.
|
||||
var scrollFactor = Math.abs(wheelEvent.angleDelta.y) >= 120 ? root.mouseScrollFactor : root.touchpadScrollFactor;
|
||||
var targetY = root.contentY - delta * scrollFactor;
|
||||
targetY = Math.max(0, Math.min(targetY, root.contentHeight - root.height));
|
||||
root.contentY = targetY;
|
||||
}
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
animations: [
|
||||
Appearance?.animation.elementMove.numberAnimation.createObject(this, {
|
||||
|
||||
@@ -282,6 +282,9 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\)
|
||||
spacing: 10
|
||||
popin: false
|
||||
|
||||
touchpadScrollFactor: 600
|
||||
mouseScrollFactor: 200
|
||||
|
||||
property int lastResponseLength: 0
|
||||
|
||||
clip: true
|
||||
|
||||
@@ -137,6 +137,9 @@ Item {
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
|
||||
touchpadScrollFactor: 600
|
||||
mouseScrollFactor: 200
|
||||
|
||||
property int lastResponseLength: 0
|
||||
|
||||
clip: true
|
||||
|
||||
Reference in New Issue
Block a user