More efficiant roomList delegate in view detection
This commit is contained in:
parent
ecb88864a9
commit
8b02f0e462
|
@ -45,20 +45,15 @@ Column {
|
|||
|
||||
delegate: HLoader {
|
||||
asynchronous: false
|
||||
active: firstSyncDone && inView
|
||||
active: index === 0 || (
|
||||
roomList.firstDelegateHeight !== 0 &&
|
||||
index >= roomList.firstIndexInView &&
|
||||
index <= roomList.lastIndexInView
|
||||
)
|
||||
|
||||
width: roomList.width
|
||||
height: roomList.firstDelegateHeight
|
||||
|
||||
// XXX: these assume the view has no spacing/margins/header/footer
|
||||
readonly property int yTop:
|
||||
accountRooms.y + account.height + accountRooms.spacing +
|
||||
model.index * height
|
||||
readonly property int yBottom: yTop + height
|
||||
readonly property bool inView:
|
||||
yBottom >= mainPaneList.contentY &&
|
||||
yTop <= mainPaneList.contentY + mainPaneList.height
|
||||
|
||||
readonly property var sourceModel: model
|
||||
|
||||
sourceComponent: Room {
|
||||
|
@ -71,7 +66,9 @@ Column {
|
|||
|
||||
highlight: null // managed by the AccountRoomsList
|
||||
|
||||
onFirstDelegateHeightChanged: firstDelegateHeight = firstDelegateHeight
|
||||
onFirstDelegateHeightChanged:
|
||||
if (firstDelegateHeight !== 0)
|
||||
firstDelegateHeight = firstDelegateHeight
|
||||
|
||||
|
||||
// Delete 0 must *always* be loaded, and all delegates must have the
|
||||
|
@ -81,6 +78,14 @@ Column {
|
|||
contentItem.visibleChildren[0].implicitHeight :
|
||||
0
|
||||
|
||||
readonly property int firstIndexInView:
|
||||
(mainPaneList.contentY - account.height - accountRooms.spacing) /
|
||||
firstDelegateHeight -
|
||||
accountRooms.y / firstDelegateHeight
|
||||
|
||||
readonly property int lastIndexInView:
|
||||
firstIndexInView + mainPaneList.height / firstDelegateHeight
|
||||
|
||||
readonly property bool hasActiveRoom:
|
||||
window.uiState.page === "Pages/Chat/Chat.qml" &&
|
||||
window.uiState.pageProperties.userId === userId
|
||||
|
|
|
@ -13,9 +13,9 @@ HTileDelegate {
|
|||
opacity:
|
||||
model.left ? theme.mainPane.listView.room.leftRoomOpacity : 1
|
||||
|
||||
topPadding: theme.spacing / (model.index === 0 ? 1 : 1.5)
|
||||
bottomPadding:
|
||||
theme.spacing / (model.index === view.count - 1 ? 1 : 1.5)
|
||||
// topPadding: theme.spacing / (model.index === 0 ? 1 : 1.5)
|
||||
// bottomPadding:
|
||||
// theme.spacing / (model.index === view.count - 1 ? 1 : 1.5)
|
||||
leftPadding: theme.spacing * 2
|
||||
rightPadding: theme.spacing
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user