fix(ChatMessagesView): Fixing scroll to message
Closing: https://github.com/status-im/status-desktop/issues/10131
This commit is contained in:
parent
79ea3e7d66
commit
5ec4360d8c
|
@ -65,6 +65,11 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goToMessage(messageIndex) {
|
||||||
|
chatLogView.currentIndex = -1
|
||||||
|
chatLogView.currentIndex = messageIndex
|
||||||
|
}
|
||||||
|
|
||||||
onIsMostRecentMessageInViewportChanged: markAllMessagesReadIfMostRecentMessageIsInViewport()
|
onIsMostRecentMessageInViewportChanged: markAllMessagesReadIfMostRecentMessageIsInViewport()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +85,12 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScrollToMessage(messageIndex) {
|
function onScrollToMessage(messageIndex) {
|
||||||
chatLogView.positionViewAtIndex(messageIndex, ListView.Center)
|
d.goToMessage(messageIndex)
|
||||||
chatLogView.itemAtIndex(messageIndex).startMessageFoundAnimation()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScrollToFirstUnreadMessage(messageIndex) {
|
function onScrollToFirstUnreadMessage(messageIndex) {
|
||||||
if (d.isMostRecentMessageInViewport) {
|
if (d.isMostRecentMessageInViewport) {
|
||||||
onScrollToMessage(messageIndex)
|
d.goToMessage(messageIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +192,12 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
spacing: 0
|
spacing: 0
|
||||||
verticalLayoutDirection: ListView.BottomToTop
|
verticalLayoutDirection: ListView.BottomToTop
|
||||||
cacheBuffer: height * 2 // cache 2 screens worth of items
|
cacheBuffer: height > 0 ? height * 2 : 0 // cache 2 screens worth of items
|
||||||
|
|
||||||
|
highlightRangeMode: ListView.ApplyRange
|
||||||
|
highlightMoveDuration: 200
|
||||||
|
preferredHighlightBegin: 0
|
||||||
|
preferredHighlightEnd: chatLogView.height/2
|
||||||
|
|
||||||
model: messageStore.messagesModel
|
model: messageStore.messagesModel
|
||||||
|
|
||||||
|
@ -201,6 +210,12 @@ Item {
|
||||||
|
|
||||||
onVisibleChanged: d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
onVisibleChanged: d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
||||||
|
|
||||||
|
onCurrentItemChanged: {
|
||||||
|
if(currentItem && currentIndex > 0) {
|
||||||
|
currentItem.startMessageFoundAnimation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: StatusScrollBar {
|
ScrollBar.vertical: StatusScrollBar {
|
||||||
visible: chatLogView.visibleArea.heightRatio < 1
|
visible: chatLogView.visibleArea.heightRatio < 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue