mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Hopefully fix the jump when replying after scrolling
This commit is contained in:
parent
779d5e9fae
commit
a5f99b50eb
2 changed files with 16 additions and 6 deletions
|
@ -28,6 +28,16 @@ Item {
|
||||||
|
|
||||||
target: MainWindow
|
target: MainWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onScrollToIndex(index) {
|
||||||
|
chat.positionViewAtIndex(index, ListView.Center);
|
||||||
|
chat.updateLastScroll();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: room
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
id: scrollbar
|
id: scrollbar
|
||||||
|
|
||||||
|
@ -59,8 +69,11 @@ Item {
|
||||||
property int lastScrollPos: 0
|
property int lastScrollPos: 0
|
||||||
|
|
||||||
// Fixup the scroll position when the height changes. Without this, the view is kept around the center of the currently visible content, while we usually want to stick to the bottom.
|
// Fixup the scroll position when the height changes. Without this, the view is kept around the center of the currently visible content, while we usually want to stick to the bottom.
|
||||||
onMovementEnded: lastScrollPos = (contentY+height)
|
function updateLastScroll() {
|
||||||
onModelChanged: lastScrollPos = (contentY+height)
|
lastScrollPos = (contentY+height);
|
||||||
|
}
|
||||||
|
onMovementEnded: updateLastScroll()
|
||||||
|
onModelChanged: updateLastScroll()
|
||||||
onHeightChanged: contentY = (lastScrollPos-height)
|
onHeightChanged: contentY = (lastScrollPos-height)
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -651,6 +664,7 @@ Item {
|
||||||
onClicked: function () {
|
onClicked: function () {
|
||||||
chat.positionViewAtBeginning();
|
chat.positionViewAtBeginning();
|
||||||
TimelineManager.focusMessageInput();
|
TimelineManager.focusMessageInput();
|
||||||
|
chat.updateLastScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -73,10 +73,6 @@ Column {
|
||||||
function onRoomAvatarUrlChanged() {
|
function onRoomAvatarUrlChanged() {
|
||||||
messageUserAvatar.url = room.avatarUrl(userId).replace("mxc://", "image://MxcImage/");
|
messageUserAvatar.url = room.avatarUrl(userId).replace("mxc://", "image://MxcImage/");
|
||||||
}
|
}
|
||||||
function onScrollToIndex(index) {
|
|
||||||
chat.positionViewAtIndex(index, ListView.Center);
|
|
||||||
}
|
|
||||||
|
|
||||||
target: room
|
target: room
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue