feat(act-center): scroll to the clicked message in the act center
Fixes #2681
This commit is contained in:
parent
0f5d889a0d
commit
d5032430f9
|
@ -192,6 +192,10 @@ StackLayout {
|
|||
id: timer
|
||||
}
|
||||
|
||||
function positionAtMessage(messageId) {
|
||||
stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].item.scrollToMessage(messageId)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
|
|
|
@ -183,6 +183,18 @@ Popup {
|
|||
pinnedBy: model.message.pinnedBy
|
||||
pinnedMessage: model.message.isPinned
|
||||
activityCenterMessage: true
|
||||
clickMessage: function (isProfileClick) {
|
||||
if (isProfileClick) {
|
||||
const pk = model.message.fromAuthor
|
||||
const userProfileImage = appMain.getProfileImage(pk)
|
||||
return openProfilePopup(chatsModel.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
|
||||
}
|
||||
|
||||
activityCenter.close()
|
||||
chatsModel.setActiveChannel(model.message.chatId)
|
||||
positionAtMessage(model.message.messageId)
|
||||
}
|
||||
|
||||
prevMessageIndex: {
|
||||
if (notificationDelegate.idx === 0) {
|
||||
return 0
|
||||
|
@ -222,6 +234,7 @@ Popup {
|
|||
}
|
||||
|
||||
ActivityChannelBadge {
|
||||
id: badge
|
||||
name: model.name
|
||||
chatId: model.chatId
|
||||
notificationType: model.notificationType
|
||||
|
|
|
@ -17,6 +17,7 @@ ScrollView {
|
|||
id: root
|
||||
|
||||
property alias chatLogView: chatLogView
|
||||
property alias scrollToMessage: chatLogView.scrollToMessage
|
||||
|
||||
property var messageList: MessagesData {}
|
||||
property bool loadingMessages: false
|
||||
|
@ -64,6 +65,17 @@ ScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
property var scrollToMessage: function (messageId) {
|
||||
let item
|
||||
for (let i = 0; i < messageListDelegate.count; i++) {
|
||||
item = messageListDelegate.items.get(i)
|
||||
if (item.model.messageId === messageId) {
|
||||
chatLogView.positionViewAtIndex(i, ListView.Center)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
id: contentHeightConnection
|
||||
enabled: true
|
||||
|
|
|
@ -176,7 +176,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function clickMessage(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false) {
|
||||
property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false) {
|
||||
if (placeholderMessage || activityCenterMessage) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@ Rectangle {
|
|||
property int contentType: 2
|
||||
|
||||
id: buttonsContainer
|
||||
visible: (buttonsContainer.parentIsHovered || isMessageActive) && contentType !== Constants.transactionType
|
||||
visible: !activityCenterMessage &&
|
||||
(buttonsContainer.parentIsHovered || isMessageActive)
|
||||
&& contentType !== Constants.transactionType
|
||||
width: buttonRow.width + buttonsContainer.containerMargin * 2
|
||||
height: 36
|
||||
radius: Style.current.radius
|
||||
|
|
|
@ -23,10 +23,12 @@ Item {
|
|||
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
|
||||
|
||||
MouseArea {
|
||||
enabled: !placeholderMessage && !activityCenterMessage
|
||||
enabled: !placeholderMessage
|
||||
anchors.fill: messageContainer
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: messageMouseArea.clicked(mouse)
|
||||
acceptedButtons: activityCenterMessage ? Qt.LeftButton : Qt.RightButton
|
||||
onClicked: {
|
||||
messageMouseArea.clicked(mouse)
|
||||
}
|
||||
}
|
||||
|
||||
ChatButtons {
|
||||
|
@ -238,6 +240,7 @@ Item {
|
|||
MessageMouseArea {
|
||||
id: messageMouseArea
|
||||
anchors.fill: stickerLoader.active ? stickerLoader : chatText
|
||||
z: activityCenterMessage ? chatText.z + 1 : chatText.z -1
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
@ -320,7 +323,8 @@ Item {
|
|||
}
|
||||
|
||||
HoverHandler {
|
||||
enabled: forceHoverHandler || (typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened)
|
||||
enabled: !activityCenterMessage &&
|
||||
(forceHoverHandler || (typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened))
|
||||
onHoveredChanged: setHovered(messageId, hovered)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,16 @@ import "../../../../../shared"
|
|||
import "../../../../../imports"
|
||||
|
||||
MouseArea {
|
||||
enabled: !placeholderMessage && !activityCenterMessage
|
||||
enabled: !placeholderMessage
|
||||
cursorShape: chatText.hoveredLink ? Qt.PointingHandCursor : undefined
|
||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
z: 50
|
||||
onClicked: {
|
||||
if(mouse.button & Qt.RightButton) {
|
||||
clickMessage(false, isSticker, false);
|
||||
if (activityCenterMessage) {
|
||||
return clickMessage(false, isSticker, false)
|
||||
}
|
||||
if(mouse.button === Qt.RightButton) {
|
||||
clickMessage(false, isSticker, false)
|
||||
if (typeof isMessageActive !== "undefined") {
|
||||
setMessageActive(messageId, true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue