summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-10-23 01:56:53 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-10-23 01:56:53 +0200
commite3ad60911d4483dbc9af6a839f97c23c9fa1dae3 (patch)
tree68bfc67e100fc6c29078be3150a1ff851b3551b3 /resources/qml
parentMigrate olm sessions to be stored in one database instead of thousands (diff)
downloadnheko-e3ad60911d4483dbc9af6a839f97c23c9fa1dae3.tar.xz
Fix scroll position jumping when replying or resizing the window
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/MessageView.qml7
1 files changed, 7 insertions, 0 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 98b9748a..df39f3d1 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -59,6 +59,13 @@ Item {
         spacing: 2
         verticalLayoutDirection: ListView.BottomToTop
 
+        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.
+        onMovementEnded: lastScrollPos = (contentY+height)
+        onModelChanged: lastScrollPos = (contentY+height)
+        onHeightChanged: contentY = (lastScrollPos-height)
+
         Component {
             id: defaultMessageStyle