mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 17:37:22 +02:00
animate scroll of partially visible cards
This commit is contained in:
parent
e4df4369ad
commit
ae5f9e4fb1
1 changed files with 18 additions and 2 deletions
|
@ -238,8 +238,24 @@ Column {
|
|||
stackShadowNarrowing: root.stackShadowNarrowing;
|
||||
shadowHeight: root.stackedCardShadowHeight;
|
||||
|
||||
hoverThunk: function () { scroll.currentIndex = index; }
|
||||
unhoverThunk: function () { scroll.currentIndex = -1; }
|
||||
hoverThunk: function () { scrollToIndex(index); }
|
||||
unhoverThunk: function () { scrollToIndex(-1); }
|
||||
}
|
||||
}
|
||||
NumberAnimation {
|
||||
id: anim;
|
||||
target: scroll;
|
||||
property: "contentX";
|
||||
duration: 500;
|
||||
}
|
||||
function scrollToIndex(index) {
|
||||
anim.running = false;
|
||||
var pos = scroll.contentX;
|
||||
var destPos;
|
||||
scroll.positionViewAtIndex(index, ListView.Contain);
|
||||
destPos = scroll.contentX;
|
||||
anim.from = pos;
|
||||
anim.to = destPos;
|
||||
anim.running = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue