Fix audio panel scroll clipping

This commit is contained in:
Ryan Hughes
2026-05-19 01:32:32 -04:00
parent 8a74d28449
commit 75962b98ea
+18 -4
View File
@@ -219,7 +219,10 @@ Item {
focusSection = "output" focusSection = "output"
selectedIndex = -1 // first keyboard cursor reveal starts on the output slider selectedIndex = -1 // first keyboard cursor reveal starts on the output slider
cursorActive = false cursorActive = false
Qt.callLater(function() { if (keyCatcher) keyCatcher.forceActiveFocus() }) Qt.callLater(function() {
resetScroll()
if (keyCatcher) keyCatcher.forceActiveFocus()
})
} }
} }
@@ -233,19 +236,30 @@ Item {
// StreamRow) calls this when it gains hasCursor. Without it, j/k can // StreamRow) calls this when it gains hasCursor. Without it, j/k can
// walk the selection off-screen — wifi uses ListView.positionViewAtIndex // walk the selection off-screen — wifi uses ListView.positionViewAtIndex
// for this; we don't have that affordance with a multi-section Column. // for this; we don't have that affordance with a multi-section Column.
function resetScroll() {
if (!scrollArea) return
var flick = scrollArea.contentItem
if (flick && flick.contentY !== undefined) flick.contentY = 0
}
function ensureCursorVisible(item) { function ensureCursorVisible(item) {
if (!item || !scrollArea) return if (!item || !scrollArea) return
var flick = scrollArea.contentItem var flick = scrollArea.contentItem
if (!flick || flick.contentY === undefined) return if (!flick || flick.contentY === undefined) return
var margin = 6
var maxY = Math.max(0, (flick.contentHeight || 0) - flick.height)
if (maxY <= Style.space(24) || (root.focusSection === "output" && root.selectedIndex === -1)) {
flick.contentY = 0
return
}
var pt = item.mapToItem(flick.contentItem || flick, 0, 0) var pt = item.mapToItem(flick.contentItem || flick, 0, 0)
var top = pt.y var top = pt.y
var bottom = top + (item.height || 0) var bottom = top + (item.height || 0)
var viewTop = flick.contentY var viewTop = flick.contentY
var viewBottom = viewTop + flick.height var viewBottom = viewTop + flick.height
var margin = 6 if (top < viewTop + margin) flick.contentY = Math.max(0, Math.min(maxY, top - margin))
if (top < viewTop + margin) flick.contentY = Math.max(0, top - margin)
else if (bottom > viewBottom - margin) else if (bottom > viewBottom - margin)
flick.contentY = bottom + margin - flick.height flick.contentY = Math.max(0, Math.min(maxY, bottom + margin - flick.height))
} }
function clampCursor() { function clampCursor() {