fix: flickable positions not updating on rebound

Also disable nexus nav fade on rebound start if content smaller than
height
And force vertical flick only on nexus nav
This commit is contained in:
2 * r + 2 * t 2026-06-04 16:28:07 +10:00
parent 328c4ba37d
commit 4586c2eac9
3 changed files with 47 additions and 2 deletions

View file

@ -4,11 +4,28 @@ import qs.components
Flickable {
id: root
property bool doneFakeFlick
maximumFlickVelocity: 3000
rebound: Transition {
onRunningChanged: {
if (!running && !root.doneFakeFlick) {
root.doneFakeFlick = true;
root.flick(1, 1);
root.flick(-1, -1);
Qt.callLater(() => root.cancelFlick());
}
}
Anim {
properties: "x,y"
}
}
Timer {
running: root.doneFakeFlick
interval: 10
onTriggered: root.doneFakeFlick = false
}
}

View file

@ -4,11 +4,28 @@ import qs.components
ListView {
id: root
property bool doneFakeFlick
maximumFlickVelocity: 3000
rebound: Transition {
onRunningChanged: {
if (!running && !root.doneFakeFlick) {
root.doneFakeFlick = true;
root.flick(1, 1);
root.flick(-1, -1);
Qt.callLater(() => root.cancelFlick());
}
}
Anim {
properties: "x,y"
}
}
Timer {
running: root.doneFakeFlick
interval: 10
onTriggered: root.doneFakeFlick = false
}
}

View file

@ -14,12 +14,23 @@ StyledFlickable {
required property NexusState nState
property real topFadeOpacity: visibleArea.yPosition > 0 ? 0 : 1
property real bottomFadeOpacity: visibleArea.yPosition + visibleArea.heightRatio < 1 ? 0 : 1
property real topFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
property real bottomFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
function fadeShouldBeActive(isStart: bool): bool {
// When content is smaller than flickable size, hide fade when rebound starts
if (contentHeight + topMargin + bottomMargin < height && rebound.running && ((isStart ? verticalOvershoot > 0 : verticalOvershoot < 0)))
return false;
if (isStart)
return visibleArea.yPosition > 0;
return visibleArea.yPosition + visibleArea.heightRatio < 1;
}
topMargin: Tokens.padding.large
bottomMargin: Tokens.padding.large
contentHeight: content.implicitHeight
flickableDirection: Flickable.VerticalFlick
layer.enabled: true
layer.effect: Mask {