diff options
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/Drawer.qml | 1 | ||||
| -rw-r--r-- | desktop/NotificationList.qml | 1 | ||||
| l---------[-rw-r--r--] | desktop/WheelScroll.qml | 56 | ||||
| -rw-r--r-- | desktop/assistant/Card.qml | 2 | ||||
| -rw-r--r-- | desktop/assistant/History.qml | 1 | ||||
| -rw-r--r-- | desktop/assistant/Models.qml | 1 | ||||
| -rw-r--r-- | desktop/assistant/Picker.qml | 1 | ||||
| -rw-r--r-- | desktop/island/ObsPill.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/appearance/StepsWindow.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/assistant/AssistantPage.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/clipboard/ClipboardPage.qml | 1 | ||||
| -rw-r--r-- | desktop/modules/notes/NotesPage.qml | 1 |
12 files changed, 16 insertions, 55 deletions
diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml index 93493cc..f77169a 100644 --- a/desktop/Drawer.qml +++ b/desktop/Drawer.qml @@ -230,6 +230,7 @@ Scope { contentHeight: grid.height clip: true boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: tiles; anchors.fill: parent; flick: tiles; step: 96 + grid.spacing } Flow { id: grid diff --git a/desktop/NotificationList.qml b/desktop/NotificationList.qml index 9fe4328..63ab1aa 100644 --- a/desktop/NotificationList.qml +++ b/desktop/NotificationList.qml @@ -61,6 +61,7 @@ Item { contentWidth: width contentHeight: col.implicitHeight boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: flick; anchors.fill: parent; flick: flick } Column { id: col diff --git a/desktop/WheelScroll.qml b/desktop/WheelScroll.qml index 845a8ff..f6de73f 100644..120000 --- a/desktop/WheelScroll.qml +++ b/desktop/WheelScroll.qml @@ -1,55 +1 @@ -// Copyright (C) 2026 Danilo M. <danix@danix.xyz> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -import QtQuick - -// Mouse wheel scrolling for a Flickable: a fixed distance per notch, -// animated, the same up and down. Qt's own wheel handling took a long -// list dozens of notches whatever maximumFlickVelocity said. Notches that arrive mid-animation add to its -// end point, so a fast spin travels further. -// -// angleDelta only. Under Wayland a mouse notch arrives as angleDelta 120 -// with pixelDelta 15 and a device typed touchpad (measured), so trusting -// a non-zero pixelDelta, as Flickable does, scrolled 15px a notch. -// ponytail: a real touchpad then scrolls by step too; tell the two apart -// (e.g. pixelDelta != angleDelta / 8) if one is ever used here. -// -// Takes no buttons, so clicks reach what is under it; wheel events that -// an inner item (a slider, a nested list) accepts never reach it. -MouseArea { - id: ws - property Flickable flick - // Pixels per notch. - property real step: 150 - - acceptedButtons: Qt.NoButton - - function clamp(y) { - return Math.max(flick.originY, Math.min(y, - flick.originY + Math.max(0, flick.contentHeight - flick.height))); - } - - NumberAnimation { - id: anim - target: ws.flick - property: "contentY" - duration: 180 - easing.type: Easing.OutCubic - } - - onWheel: wheel => { - flick.cancelFlick(); - const from = anim.running ? anim.to : flick.contentY; - anim.stop(); - anim.to = clamp(from - wheel.angleDelta.y / 120 * step); - anim.start(); - } -} +../shared/WheelScroll.qml
\ No newline at end of file diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml index 2f9af69..f4e1af1 100644 --- a/desktop/assistant/Card.qml +++ b/desktop/assistant/Card.qml @@ -252,6 +252,7 @@ Rectangle { onMovementStarted: stick = false onMovementEnded: stick = atYEnd onContentHeightChanged: if (stick) Qt.callLater(positionViewAtEnd) + WheelScroll { parent: list; anchors.fill: parent; flick: list; onSettled: list.stick = list.atYEnd } Component.onCompleted: positionViewAtEnd() delegate: Message { @@ -588,6 +589,7 @@ Rectangle { contentHeight: input.contentHeight clip: true boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: scroller; anchors.fill: parent; flick: scroller; step: 60 } function follow(r) { if (r.y < contentY) contentY = r.y; else if (r.y + r.height > contentY + height) contentY = r.y + r.height - height; diff --git a/desktop/assistant/History.qml b/desktop/assistant/History.qml index 709e1a6..1b2a355 100644 --- a/desktop/assistant/History.qml +++ b/desktop/assistant/History.qml @@ -58,6 +58,7 @@ Rectangle { spacing: 4 boundsBehavior: Flickable.StopAtBounds model: field.text.trim() === "" ? panel.canvas.convs : panel.canvas.results + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/assistant/Models.qml b/desktop/assistant/Models.qml index b1b2a38..1fa1d37 100644 --- a/desktop/assistant/Models.qml +++ b/desktop/assistant/Models.qml @@ -30,6 +30,7 @@ Rectangle { clip: true spacing: 2 model: panel.canvas.models + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/assistant/Picker.qml b/desktop/assistant/Picker.qml index 6d7b8ad..4c691ec 100644 --- a/desktop/assistant/Picker.qml +++ b/desktop/assistant/Picker.qml @@ -108,6 +108,7 @@ Rectangle { boundsBehavior: Flickable.StopAtBounds model: files highlightMoveDuration: 0 + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/island/ObsPill.qml b/desktop/island/ObsPill.qml index 3fdb4a3..c4b0870 100644 --- a/desktop/island/ObsPill.qml +++ b/desktop/island/ObsPill.qml @@ -134,11 +134,13 @@ Capsule { // ponytail: four columns, two rows visible; the wheel scrolls beyond // eight scenes. Selection is click-only, so scrolling never switches. Flickable { + id: scenes width: controls.width height: Math.min(80, grid.childrenRect.height) contentHeight: grid.childrenRect.height clip: true flickableDirection: Flickable.VerticalFlick + WheelScroll { parent: scenes; anchors.fill: parent; flick: scenes; step: 40 } Grid { id: grid diff --git a/desktop/modules/appearance/StepsWindow.qml b/desktop/modules/appearance/StepsWindow.qml index aeb77fe..dcfe705 100644 --- a/desktop/modules/appearance/StepsWindow.qml +++ b/desktop/modules/appearance/StepsWindow.qml @@ -106,6 +106,7 @@ Scope { } Flickable { + id: steps width: parent.width // Sized from the screen, never from the window: the // window's height comes from this, and a binding back @@ -114,6 +115,7 @@ Scope { win.screen.height - 240 - tabBar.implicitHeight - actions.implicitHeight - 32) contentHeight: content.implicitHeight clip: true + WheelScroll { parent: steps; anchors.fill: parent; flick: steps } Column { id: content diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml index 0875a5d..a952b4f 100644 --- a/desktop/modules/assistant/AssistantPage.qml +++ b/desktop/modules/assistant/AssistantPage.qml @@ -398,7 +398,9 @@ Column { color: Theme.surface ScrollView { + id: promptScroll anchors { fill: parent; margins: 8 } + WheelScroll { parent: promptScroll; anchors.fill: parent; flick: promptScroll.contentItem; step: 60 } TextArea { id: prompt wrapMode: TextEdit.Wrap diff --git a/desktop/modules/clipboard/ClipboardPage.qml b/desktop/modules/clipboard/ClipboardPage.qml index 945557c..9b48909 100644 --- a/desktop/modules/clipboard/ClipboardPage.qml +++ b/desktop/modules/clipboard/ClipboardPage.qml @@ -101,6 +101,7 @@ Item { highlightMoveDuration: 0 boundsBehavior: Flickable.StopAtBounds ScrollBar.vertical: ScrollBar {} + WheelScroll { parent: list; anchors.fill: parent; flick: list } Text { anchors.centerIn: parent diff --git a/desktop/modules/notes/NotesPage.qml b/desktop/modules/notes/NotesPage.qml index c4563e0..8130c7e 100644 --- a/desktop/modules/notes/NotesPage.qml +++ b/desktop/modules/notes/NotesPage.qml @@ -221,6 +221,7 @@ Item { model: Notes.filter(page.owner.notes, search.text) boundsBehavior: Flickable.StopAtBounds ScrollBar.vertical: ScrollBar {} + WheelScroll { parent: list; anchors.fill: parent; flick: list } delegate: Rectangle { id: row |
