AccountRoomsList highlight delegate scrolling

This commit is contained in:
miruka
2020-02-13 05:36:28 -04:00
parent a78f5506b8
commit 4636a36154
2 changed files with 17 additions and 3 deletions

View File

@@ -14,12 +14,13 @@ HListView {
height: childrenRect.height
}
// Must handle the highlight's position and size manually because
// of our nested lists
highlightFollowsCurrentItem: false
currentItemHeight:
selectedRoom ? selectedRoom.height :
currentItem ? currentItem.account.height : 0
highlightRangeMode: ListView.NoHighlightRange
highlight: Rectangle {
id: highlightRectangle
y:
selectedRoom ?
currentItem.y + currentItem.account.height +
@@ -36,6 +37,18 @@ HListView {
Behavior on y { HNumberAnimation {} }
Behavior on height { HNumberAnimation {} }
Binding {
target: mainPaneList
property: "contentY"
value: Math.max(
0,
highlightRectangle.y + highlightRectangle.height / 2 -
mainPaneList.height / 2,
)
when: ! mainPaneList.horizontalOvershoot
delayed: true
}
}