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:
parent
328c4ba37d
commit
4586c2eac9
3 changed files with 47 additions and 2 deletions
|
|
@ -4,11 +4,28 @@ import qs.components
|
||||||
Flickable {
|
Flickable {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property bool doneFakeFlick
|
||||||
|
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
|
onRunningChanged: {
|
||||||
|
if (!running && !root.doneFakeFlick) {
|
||||||
|
root.doneFakeFlick = true;
|
||||||
|
root.flick(1, 1);
|
||||||
|
root.flick(-1, -1);
|
||||||
|
Qt.callLater(() => root.cancelFlick());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: root.doneFakeFlick
|
||||||
|
interval: 10
|
||||||
|
onTriggered: root.doneFakeFlick = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,28 @@ import qs.components
|
||||||
ListView {
|
ListView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property bool doneFakeFlick
|
||||||
|
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
|
onRunningChanged: {
|
||||||
|
if (!running && !root.doneFakeFlick) {
|
||||||
|
root.doneFakeFlick = true;
|
||||||
|
root.flick(1, 1);
|
||||||
|
root.flick(-1, -1);
|
||||||
|
Qt.callLater(() => root.cancelFlick());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: root.doneFakeFlick
|
||||||
|
interval: 10
|
||||||
|
onTriggered: root.doneFakeFlick = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,23 @@ StyledFlickable {
|
||||||
|
|
||||||
required property NexusState nState
|
required property NexusState nState
|
||||||
|
|
||||||
property real topFadeOpacity: visibleArea.yPosition > 0 ? 0 : 1
|
property real topFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
||||||
property real bottomFadeOpacity: visibleArea.yPosition + visibleArea.heightRatio < 1 ? 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
|
topMargin: Tokens.padding.large
|
||||||
bottomMargin: Tokens.padding.large
|
bottomMargin: Tokens.padding.large
|
||||||
contentHeight: content.implicitHeight
|
contentHeight: content.implicitHeight
|
||||||
|
flickableDirection: Flickable.VerticalFlick
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.effect: Mask {
|
layer.effect: Mask {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue