Fix jumping issues.
This commit is contained in:
@@ -31,10 +31,24 @@ Kirigami.ScrollablePage {
|
|||||||
room: currentRoom
|
room: currentRoom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SortFilterProxyModel {
|
||||||
|
id: sortedMessageEventModel
|
||||||
|
|
||||||
|
sourceModel: messageEventModel
|
||||||
|
|
||||||
|
filters: [
|
||||||
|
ExpressionFilter {
|
||||||
|
expression: marks !== 0x10 && eventType !== "other"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
|
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
|
||||||
readonly property bool noNeedMoreContent: !currentRoom || currentRoom.eventsHistoryJob || currentRoom.allHistoryLoaded
|
readonly property bool noNeedMoreContent: !currentRoom || currentRoom.eventsHistoryJob || currentRoom.allHistoryLoaded
|
||||||
|
|
||||||
|
readonly property bool isLoaded: page.width * page.height > 10
|
||||||
|
|
||||||
id: messageListView
|
id: messageListView
|
||||||
|
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
@@ -44,62 +58,45 @@ Kirigami.ScrollablePage {
|
|||||||
verticalLayoutDirection: ListView.BottomToTop
|
verticalLayoutDirection: ListView.BottomToTop
|
||||||
highlightMoveDuration: 500
|
highlightMoveDuration: 500
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
model: !isLoaded ? undefined : sortedMessageEventModel
|
||||||
id: sortedMessageEventModel
|
|
||||||
|
|
||||||
sourceModel: messageEventModel
|
|
||||||
|
|
||||||
filters: [
|
|
||||||
ExpressionFilter {
|
|
||||||
expression: marks !== 0x10 && eventType !== "other"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
onModelReset: {
|
|
||||||
if (currentRoom) {
|
|
||||||
if (currentRoom.timelineSize < 20)
|
|
||||||
currentRoom.getPreviousContent(50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onContentYChanged: {
|
onContentYChanged: {
|
||||||
if(!noNeedMoreContent && contentY - 5000 < originY)
|
if(!noNeedMoreContent && contentY - 5000 < originY)
|
||||||
currentRoom.getPreviousContent(20);
|
currentRoom.getPreviousContent(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
populate: Transition {
|
// populate: Transition {
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "opacity"; from: 0; to: 1
|
// property: "opacity"; from: 0; to: 1
|
||||||
duration: 200
|
// duration: 200
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
add: Transition {
|
// add: Transition {
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "opacity"; from: 0; to: 1
|
// property: "opacity"; from: 0; to: 1
|
||||||
duration: 200
|
// duration: 200
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
move: Transition {
|
// move: Transition {
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "y"; duration: 200
|
// property: "y"; duration: 200
|
||||||
}
|
// }
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "opacity"; to: 1
|
// property: "opacity"; to: 1
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
displaced: Transition {
|
// displaced: Transition {
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "y"; duration: 200
|
// property: "y"; duration: 200
|
||||||
easing.type: Easing.OutQuad
|
// easing.type: Easing.OutQuad
|
||||||
}
|
// }
|
||||||
NumberAnimation {
|
// NumberAnimation {
|
||||||
property: "opacity"; to: 1
|
// property: "opacity"; to: 1
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
delegate: DelegateChooser {
|
delegate: DelegateChooser {
|
||||||
role: "eventType"
|
role: "eventType"
|
||||||
@@ -218,6 +215,15 @@ Kirigami.ScrollablePage {
|
|||||||
delegate: Item {}
|
delegate: Item {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (currentRoom) {
|
||||||
|
if (currentRoom.timelineSize < 20)
|
||||||
|
currentRoom.getPreviousContent(50)
|
||||||
|
}
|
||||||
|
|
||||||
|
positionViewAtBeginning()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: RowLayout {
|
footer: RowLayout {
|
||||||
|
|||||||
Reference in New Issue
Block a user