summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-05-27 21:57:26 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-05-27 21:57:26 +0200
commit643be19b648ba09caff400934a1fe626a4826d66 (patch)
tree81b7d38a3c9742ee236529976fc5bff537706fa6 /resources/qml
parentFix an empty profile name allowing you to open a profile twice (diff)
downloadnheko-643be19b648ba09caff400934a1fe626a4826d66.tar.xz
fix marking messages as read by scrolling
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/MessageView.qml20
-rw-r--r--resources/qml/TimelineBubbleMessageStyle.qml1
-rw-r--r--resources/qml/TimelineDefaultMessageStyle.qml5
-rw-r--r--resources/qml/TimelineEvent.qml1
4 files changed, 24 insertions, 3 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 5ad414f7..f253b7a8 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -84,6 +84,16 @@ Item {
                 messageContextMenu: messageContextMenuC
                 replyContextMenu: replyContextMenuC
                 scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY)
+                data: [
+                    Connections {
+                        function onMovementEnded() {
+                            if (y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height) {
+                                room.currentIndex = index;
+                            }
+                        }
+                        target: chat
+                    }
+                ]
             }
         }
         Component {
@@ -94,6 +104,16 @@ Item {
                 messageContextMenu: messageContextMenuC
                 replyContextMenu: replyContextMenuC
                 scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY)
+                data: [
+                    Connections {
+                        function onMovementEnded() {
+                            if (y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height) {
+                                room.currentIndex = index;
+                            }
+                        }
+                        target: chat
+                    }
+                ]
             }
         }
 
diff --git a/resources/qml/TimelineBubbleMessageStyle.qml b/resources/qml/TimelineBubbleMessageStyle.qml
index 3b0f2d94..dd197264 100644
--- a/resources/qml/TimelineBubbleMessageStyle.qml
+++ b/resources/qml/TimelineBubbleMessageStyle.qml
@@ -45,7 +45,6 @@ TimelineEvent {
     property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
 
     property alias hovered: messageHover.hovered
-    property bool scrolledToThis: false
 
     mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0) + 4
     replyInset: mainInset + 4 + Nheko.paddingSmall
diff --git a/resources/qml/TimelineDefaultMessageStyle.qml b/resources/qml/TimelineDefaultMessageStyle.qml
index 331a5dfe..16db9964 100644
--- a/resources/qml/TimelineDefaultMessageStyle.qml
+++ b/resources/qml/TimelineDefaultMessageStyle.qml
@@ -45,7 +45,6 @@ TimelineEvent {
     property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
 
     property alias hovered: messageHover.hovered
-    property bool scrolledToThis: false
 
     mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0)
     replyInset: mainInset + 4 + Nheko.paddingSmall
@@ -127,7 +126,9 @@ TimelineEvent {
                         to: 0
                     }
                     ScriptAction {
-                        script: wrapper.room.eventShown()
+                        script: {
+                            wrapper.room.eventShown();
+                        }
                     }
                 }
             }
diff --git a/resources/qml/TimelineEvent.qml b/resources/qml/TimelineEvent.qml
index 3cc239c9..ef1a9578 100644
--- a/resources/qml/TimelineEvent.qml
+++ b/resources/qml/TimelineEvent.qml
@@ -13,6 +13,7 @@ EventDelegateChooser {
     id: wrapper
 
     required property bool isStateEvent
+    property bool scrolledToThis: false
 
     // qmllint disable required
     EventDelegateChoice {