fix(Chat/ReactionDialog): The reaction dialog is shown in different places

Changed x and y assignment trigger to get the correct value once the position depends on the own popup height.

Fixes #6264
This commit is contained in:
Noelia 2022-07-11 13:50:21 +02:00 committed by Noelia
parent 1c30eff74b
commit 47897f431f
3 changed files with 12 additions and 8 deletions

View File

@ -764,11 +764,14 @@ Item {
onAddEmojiClicked: { onAddEmojiClicked: {
if(root.isChatBlocked) if(root.isChatBlocked)
return return
// First set parent, X & Y positions for the messageContextMenu
root.messageContextMenu.parent = emojiRect
root.messageContextMenu.setXPosition = function() { return (root.messageContextMenu.parent.x + root.messageContextMenu.parent.width + 4) }
root.messageContextMenu.setYPosition = function() { return (-root.messageContextMenu.height - 4) }
// Second, add emoji that also triggers setXYPosition methods / open popup:
root.addEmoji(false, false, false, null, true, false); root.addEmoji(false, false, false, null, true, false);
// Set parent, X & Y positions for the messageContextMenu
root.messageContextMenu.parent = emojiReactionLoader
root.messageContextMenu.setXPosition = function() { return (root.messageContextMenu.parent.x + 4)}
root.messageContextMenu.setYPosition = function() { return (-root.messageContextMenu.height - 4)}
} }
onToggleReaction: { onToggleReaction: {

View File

@ -102,6 +102,11 @@ StatusPopupMenu {
onHeightChanged: { root.y = setYPosition(); } onHeightChanged: { root.y = setYPosition(); }
onWidthChanged: { root.x = setXPosition(); } onWidthChanged: { root.x = setXPosition(); }
onOpened: {
// Trigger x and y position:
x = setXPosition()
y = setYPosition()
}
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, 200) width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, 200)

View File

@ -212,10 +212,6 @@ Loader {
messageContextMenu.selectedUserIcon = obj.senderIconToShow messageContextMenu.selectedUserIcon = obj.senderIconToShow
} }
messageContextMenu.x = messageContextMenu.setXPosition()
messageContextMenu.y = messageContextMenu.setYPosition()
messageContextMenu.popup() messageContextMenu.popup()
} }