Skip to content

Commit 4fbcd05

Browse files
committed
Timeline: scroll faster with mouse wheel
An easy-going vertical wheel scroll over the timeline is expected by the users even if shuttleDial is enabled.
1 parent 68990e6 commit 4fbcd05

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

client/qml/Timeline.qml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ Rectangle {
262262
contentY = Math.min(originY + contentHeight - height,
263263
contentY + height)
264264
}
265+
function onWheel(wheel) {
266+
var yDelta = wheel.angleDelta.y / 120 * 100
267+
268+
if (yDelta > 0) {
269+
contentY = Math.max(originY, contentY - yDelta)
270+
} else {
271+
contentY = Math.min(contentY + (originY + contentHeight) - (contentY + height),
272+
contentY + Math.abs(yDelta))
273+
}
274+
}
265275
Connections {
266276
target: controller
267277
onPageUpPressed: chatView.pageUp()
@@ -353,6 +363,18 @@ Rectangle {
353363
}
354364
}
355365
}
366+
MouseArea {
367+
anchors.fill: chatScrollView
368+
acceptedButtons: Qt.NoButton
369+
onWheel: {
370+
if (wheel.angleDelta.x == 0) {
371+
chatView.onWheel(wheel)
372+
wheel.accepted = true
373+
} else {
374+
wheel.accepted = false
375+
}
376+
}
377+
}
356378
Slider {
357379
id: shuttleDial
358380
orientation: Qt.Vertical

0 commit comments

Comments
 (0)