Snap NarrowHeader cover to either big or small

This commit is contained in:
Chris Josten 2021-02-16 17:53:31 +01:00
parent c1b0bddd10
commit 8552e08a12
1 changed files with 25 additions and 0 deletions

View File

@ -43,6 +43,31 @@ Item {
width: parent.width
//spacing: Theme.paddingLarge
Connections {
target: listview
onVerticalVelocityChanged: {
if (!listview.draggingVertically && Math.abs(listview.verticalVelocity) < Theme.itemSizeMedium
&& listview.contentY < -smallSize) {
if (listview.verticalVelocity > 0) {
listview.cancelFlick()
listviewShrinkAnimation.start()
} else if (listview.verticalVelocity < 0){
listview.cancelFlick()
listviewGrowAnimation.start()
}
}
}
onDraggingVerticallyChanged: {
if (!listview.draggingVertically && listview.verticalVelocity == 0) {
if (-smallSize - listview.contentY > -bigSize - listview.contentY) {
listviewShrinkAnimation.start()
} else {
listviewGrowAnimation.start()
}
}
}
}
MouseArea {
anchors.fill: albumArtImage
onClicked: {