diff --git a/src/gui/MainPane/AccountRoomsDelegate.qml b/src/gui/MainPane/AccountRoomsDelegate.qml index 0aa85ced..14833fc4 100644 --- a/src/gui/MainPane/AccountRoomsDelegate.qml +++ b/src/gui/MainPane/AccountRoomsDelegate.qml @@ -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 diff --git a/src/gui/MainPane/Room.qml b/src/gui/MainPane/Room.qml index 203d0dcf..8f775dc9 100644 --- a/src/gui/MainPane/Room.qml +++ b/src/gui/MainPane/Room.qml @@ -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