fix(CompactMessage): fix message hover getting stuck
Fixes #2226 and #2196
This commit is contained in:
parent
58e292e9ab
commit
2e25bf4f8a
|
@ -22,6 +22,25 @@ ScrollView {
|
||||||
property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
|
property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
|
||||||
property int newMessages: 0
|
property int newMessages: 0
|
||||||
|
|
||||||
|
property string hoveredMessage
|
||||||
|
property string activeMessage
|
||||||
|
|
||||||
|
function setHovered(messageId, hovered) {
|
||||||
|
if (hovered) {
|
||||||
|
hoveredMessage = messageId
|
||||||
|
} else if (hoveredMessage === messageId) {
|
||||||
|
hoveredMessage = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMessageActive(messageId, active) {
|
||||||
|
if (active) {
|
||||||
|
activeMessage = messageId
|
||||||
|
} else if (activeMessage === messageId) {
|
||||||
|
activeMessage = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: chatLogView
|
contentItem: chatLogView
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
|
@ -59,7 +59,7 @@ Rectangle {
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
onClicked: {
|
onClicked: {
|
||||||
isMessageActive = true
|
setMessageActive(messageId, true)
|
||||||
clickMessage(false, false, false, null, true)
|
clickMessage(false, false, false, null, true)
|
||||||
messageContextMenu.x = buttonsContainer.x + buttonsContainer.width - messageContextMenu.width
|
messageContextMenu.x = buttonsContainer.x + buttonsContainer.width - messageContextMenu.width
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ Item {
|
||||||
property int contentType: 2
|
property int contentType: 2
|
||||||
property var container
|
property var container
|
||||||
property bool isCurrentUser: false
|
property bool isCurrentUser: false
|
||||||
property bool isHovered: false
|
property bool isHovered: typeof hoveredMessage !== "undefined" && hoveredMessage === messageId
|
||||||
property bool isMessageActive: false
|
property bool isMessageActive: typeof activeMessage !== "undefined" && activeMessage === messageId
|
||||||
property bool headerRepeatCondition: (authorCurrentMsg !== authorPrevMsg || shouldRepeatHeader || dateGroupLbl.visible)
|
property bool headerRepeatCondition: (authorCurrentMsg !== authorPrevMsg || shouldRepeatHeader || dateGroupLbl.visible)
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
@ -32,7 +32,7 @@ Item {
|
||||||
ChatButtons {
|
ChatButtons {
|
||||||
contentType: root.contentType
|
contentType: root.contentType
|
||||||
parentIsHovered: root.isHovered
|
parentIsHovered: root.isHovered
|
||||||
onHoverChanged: root.isHovered = hovered
|
onHoverChanged: hovered && setHovered(messageId, hovered)
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 20
|
anchors.rightMargin: 20
|
||||||
anchors.top: messageContainer.top
|
anchors.top: messageContainer.top
|
||||||
|
@ -46,7 +46,7 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
enabled: root.isMessageActive
|
enabled: root.isMessageActive
|
||||||
target: messageContextMenu
|
target: messageContextMenu
|
||||||
onClosed: root.isMessageActive = false
|
onClosed: setMessageActive(messageId, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,9 +243,7 @@ Item {
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
enabled: typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened
|
enabled: typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened
|
||||||
onHoveredChanged: {
|
onHoveredChanged: setHovered(messageId, hovered)
|
||||||
root.isHovered = hovered;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
@ -258,7 +256,7 @@ Item {
|
||||||
|
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
EmojiReactions {
|
EmojiReactions {
|
||||||
onHoverChanged: root.isHovered = hovered
|
onHoverChanged: setHovered(messageId, hovered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ Item {
|
||||||
onExited: addEmojiBtn.isHovered = false
|
onExited: addEmojiBtn.isHovered = false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (typeof isMessageActive !== "undefined") {
|
if (typeof isMessageActive !== "undefined") {
|
||||||
isMessageActive = true
|
setMessageActive(messageId, true)
|
||||||
}
|
}
|
||||||
clickMessage(false, false, false, null, true)
|
clickMessage(false, false, false, null, true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ MouseArea {
|
||||||
if(mouse.button & Qt.RightButton) {
|
if(mouse.button & Qt.RightButton) {
|
||||||
clickMessage(false, isSticker, false);
|
clickMessage(false, isSticker, false);
|
||||||
if (typeof isMessageActive !== "undefined") {
|
if (typeof isMessageActive !== "undefined") {
|
||||||
isMessageActive = true
|
setMessageActive(messageId, true)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue