1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-25 10:25:17 +00:00

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

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: {