fix marking messages as read by scrolling

This commit is contained in:
Nicolas Werner 2024-05-27 21:57:26 +02:00
parent 3ad0f15f6d
commit 643be19b64
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 24 additions and 3 deletions

View file

@ -84,6 +84,16 @@ Item {
messageContextMenu: messageContextMenuC messageContextMenu: messageContextMenuC
replyContextMenu: replyContextMenuC replyContextMenu: replyContextMenuC
scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY) 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 { Component {
@ -94,6 +104,16 @@ Item {
messageContextMenu: messageContextMenuC messageContextMenu: messageContextMenuC
replyContextMenu: replyContextMenuC replyContextMenu: replyContextMenuC
scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY) 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
}
]
} }
} }

View file

@ -45,7 +45,6 @@ TimelineEvent {
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
property alias hovered: messageHover.hovered property alias hovered: messageHover.hovered
property bool scrolledToThis: false
mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0) + 4 mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0) + 4
replyInset: mainInset + 4 + Nheko.paddingSmall replyInset: mainInset + 4 + Nheko.paddingSmall

View file

@ -45,7 +45,6 @@ TimelineEvent {
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
property alias hovered: messageHover.hovered property alias hovered: messageHover.hovered
property bool scrolledToThis: false
mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0) mainInset: (threadId ? (4 + Nheko.paddingSmall) : 0)
replyInset: mainInset + 4 + Nheko.paddingSmall replyInset: mainInset + 4 + Nheko.paddingSmall
@ -127,7 +126,9 @@ TimelineEvent {
to: 0 to: 0
} }
ScriptAction { ScriptAction {
script: wrapper.room.eventShown() script: {
wrapper.room.eventShown();
}
} }
} }
} }

View file

@ -13,6 +13,7 @@ EventDelegateChooser {
id: wrapper id: wrapper
required property bool isStateEvent required property bool isStateEvent
property bool scrolledToThis: false
// qmllint disable required // qmllint disable required
EventDelegateChoice { EventDelegateChoice {