mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 19:59:20 +02:00
Merge pull request #10447 from davidkelly/dk/smoothScrollFeed
animate scroll of partially visible cards
This commit is contained in:
commit
63f2a1061a
1 changed files with 19 additions and 2 deletions
|
@ -238,8 +238,25 @@ 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: 250;
|
||||
}
|
||||
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;
|
||||
scroll.currentIndex = index;
|
||||
anim.running = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue