Merge pull request #224 from monich/image-click

Fixed long tap on an image
This commit is contained in:
Sebastian Wolf 2020-12-04 19:23:07 +01:00 committed by GitHub
commit 01d3ff18cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View file

@ -32,6 +32,13 @@ Item {
width: parent.width
height: singleImage.visible ? Math.min(defaultHeight, singleImage.bestHeight + Theme.paddingSmall) : defaultHeight
function clicked() {
pageStack.push(Qt.resolvedUrl("../pages/ImagePage.qml"), {
"photoData" : imagePreviewItem.photoData,
"pictureFileInformation" : imageFile.fileInformation
})
}
Component.onCompleted: {
if (photoData) {
// Check first which size fits best...
@ -68,15 +75,6 @@ Item {
visible: status === Image.Ready
opacity: visible ? 1 : 0
Behavior on opacity { FadeAnimation {} }
MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push(Qt.resolvedUrl("../pages/ImagePage.qml"), {
"photoData" : imagePreviewItem.photoData,
"pictureFileInformation" : imageFile.fileInformation
})
}
}
}
BackgroundImage {

View file

@ -47,6 +47,15 @@ ListItem {
onClicked: {
if(messageListItem.precalculatedValues.pageIsSelecting) {
page.toggleMessageSelection(myMessage);
} else {
// Allow extra context to react to click
var extraContent = extraContentLoader.item
if (extraContent && ("clicked" in extraContent) && (typeof extraContent.clicked === "function") &&
mouseX >= extraContentLoader.x && mouseY >= extraContentLoader.y &&
mouseX < (extraContentLoader.x + extraContentLoader.width) &&
mouseY < (extraContentLoader.y + extraContentLoader.height)) {
extraContent.clicked()
}
}
}