summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorMalte E <97891689+maltee1@users.noreply.github.com>2022-03-24 01:35:42 +0100
committerGitHub <noreply@github.com>2022-03-24 00:35:42 +0000
commit13baf774358e700de65ca7dc934eb276ea29442a (patch)
treed7142bc280bc734b57de9b5fb797718e1cbaa9a8 /resources/qml/delegates
parentRemove brew upgrade now that the VM is updated (diff)
downloadnheko-13baf774358e700de65ca7dc934eb276ea29442a.tar.xz
Better touch scrolling (#1012)
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/ImageMessage.qml21
-rw-r--r--resources/qml/delegates/Reply.qml28
2 files changed, 18 insertions, 31 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml

index 2ee8da7f..23cca019 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml
@@ -5,9 +5,10 @@ import QtQuick 2.15 import QtQuick.Window 2.15 +import QtQuick.Controls 2.3 import im.nheko 1.0 -Item { +AbstractButton { required property int type required property int originalWidth required property double proportionalHeight @@ -24,6 +25,7 @@ Item { implicitWidth: Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1)) width: Math.min(parent.width,implicitWidth) height: width*proportionalHeight + hoverEnabled: true property int metadataWidth property bool fitsMetadata: (parent.width - width) > metadataWidth+4 @@ -61,28 +63,17 @@ Item { visible: loaded anchors.fill: parent roomm: room - play: !Settings.animateImagesOnHover || mouseArea.hovered + play: !Settings.animateImagesOnHover || parent.hovered eventId: parent.eventId } - TapHandler { - //enabled: type == MtxEvent.ImageMessage && (img.status == Image.Ready || mxcimage.loaded) - onSingleTapped: { - Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId); - eventPoint.accepted = true; - } - gesturePolicy: TapHandler.ReleaseWithinBounds - } - - HoverHandler { - id: mouseArea - } + onClicked :Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId); Item { id: overlay anchors.fill: parent - visible: mouseArea.hovered + visible: parent.hovered Rectangle { id: container diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 27fb4e07..53a007fe 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -11,7 +11,7 @@ import QtQuick.Window 2.13 import im.nheko 1.0 import "../" -Item { +AbstractButton { id: r property color userColor: "red" @@ -57,6 +57,16 @@ Item { color: TimelineManager.userColor(userId, Nheko.colors.base) } + onClicked: { + let link = reply.child.linkAt != undefined && reply.child.linkAt(pressX-colorLine.width, pressY - userName_.implicitHeight); + if (link) { + Nheko.openLink(link) + } else { + room.showEvent(r.eventId) + } + } + onPressAndHold: replyContextMenu.show(reply.child.copyText, reply.child.linkAt(pressX-colorLine.width, pressY - userName_.implicitHeight), r.eventId) + ColumnLayout { id: replyContainer @@ -65,22 +75,8 @@ Item { spacing: 0 TapHandler { - acceptedButtons: Qt.LeftButton - onSingleTapped: { - let link = reply.child.linkAt != undefined && reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight); - if (link) { - Nheko.openLink(link) - } else { - room.showEvent(r.eventId) - } - } - gesturePolicy: TapHandler.ReleaseWithinBounds - } - - TapHandler { acceptedButtons: Qt.RightButton - onLongPressed: replyContextMenu.show(reply.child.copyText, reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight)) - onSingleTapped: replyContextMenu.show(reply.child.copyText, reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight)) + onSingleTapped: replyContextMenu.show(reply.child.copyText, reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight), r.eventId) gesturePolicy: TapHandler.ReleaseWithinBounds }