fix(@desktop/chat)!: adjust image context menu size and position
Fixes #6830 Requires https://github.com/status-im/StatusQ/pull/852 BREAKING CHANGE: StatusImageModal clicked signal contains MouseEvent now
This commit is contained in:
parent
fbc10e7665
commit
78969cb8e0
|
@ -1 +1 @@
|
||||||
Subproject commit e1d8d934b327df616dfc0afe084f0902ebb8b300
|
Subproject commit 76cc5fda2254d9739da61df9bdb9ac5b23fa9513
|
|
@ -140,12 +140,15 @@ Item {
|
||||||
StatusImageModal {
|
StatusImageModal {
|
||||||
id: imagePopup
|
id: imagePopup
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
imagePopup.close()
|
imagePopup.close()
|
||||||
} else if(button === Qt.RightButton) {
|
} else if(mouse.button === Qt.RightButton) {
|
||||||
contextMenu.imageSource = imagePopup.imageSource
|
contextMenu.imageSource = imagePopup.imageSource
|
||||||
contextMenu.hideEmojiPicker = true
|
contextMenu.hideEmojiPicker = true
|
||||||
contextMenu.isRightClickOnImage = true;
|
contextMenu.isRightClickOnImage = true
|
||||||
|
contextMenu.parent = imagePopup.contentItem
|
||||||
|
contextMenu.setXPosition = function() { return mouse.x + Style.current.smallPadding }
|
||||||
|
contextMenu.setYPosition = function() { return mouse.y - Style.current.smallPadding }
|
||||||
contextMenu.show()
|
contextMenu.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import shared 1.0
|
||||||
Popup {
|
Popup {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
signal clicked(var button)
|
signal clicked(var mouse)
|
||||||
property string imageSource: messageImage.source
|
property string imageSource: messageImage.source
|
||||||
property var contextMenu
|
property var contextMenu
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ Popup {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.clicked(mouse.button)
|
root.clicked(mouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,8 +578,14 @@ Item {
|
||||||
else if (mouse.button === Qt.RightButton) {
|
else if (mouse.button === Qt.RightButton) {
|
||||||
// Set parent, X & Y positions for the messageContextMenu
|
// Set parent, X & Y positions for the messageContextMenu
|
||||||
root.messageContextMenu.parent = root
|
root.messageContextMenu.parent = root
|
||||||
root.messageContextMenu.setXPosition = function() { return (mouse.x)}
|
|
||||||
root.messageContextMenu.setYPosition = function() { return (mouse.y)}
|
const mappedPos = root.mapFromItem(
|
||||||
|
this,
|
||||||
|
mouse.x + Style.current.smallPadding,
|
||||||
|
mouse.y - Style.current.smallPadding)
|
||||||
|
|
||||||
|
root.messageContextMenu.setXPosition = function() { return mappedPos.x }
|
||||||
|
root.messageContextMenu.setYPosition = function() { return mappedPos.y }
|
||||||
root.clickMessage(false, false, true, image, false, true, false, true, imageSource)
|
root.clickMessage(false, false, true, image, false, true, false, true, imageSource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,8 @@ StatusPopupMenu {
|
||||||
y = setYPosition()
|
y = setYPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, 230)
|
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0,
|
||||||
|
(root.isRightClickOnImage && !root.pinnedPopup) ? 176 : 230)
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
if (root.isProfile && root.selectedUserPublicKey !== "") {
|
if (root.isProfile && root.selectedUserPublicKey !== "") {
|
||||||
|
@ -208,7 +209,7 @@ StatusPopupMenu {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
visible: root.isProfile
|
visible: root.isProfile
|
||||||
height: root.topPadding
|
height: visible ? root.topPadding : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Separator {
|
Separator {
|
||||||
|
|
Loading…
Reference in New Issue