summary refs log tree commit diff
path: root/resources/qml/TimelineRow.qml
diff options
context:
space:
mode:
authorMalte E <97891689+maltee1@users.noreply.github.com>2022-03-27 21:23:40 +0200
committerGitHub <noreply@github.com>2022-03-27 19:23:40 +0000
commit5078bdd14f5a3b521b1f7a6541c7b5875af61fc1 (patch)
tree4e807df014d5215bd6e44cc6ec5cb454930eedcb /resources/qml/TimelineRow.qml
parentTranslated using Weblate (Dutch) (diff)
downloadnheko-5078bdd14f5a3b521b1f7a6541c7b5875af61fc1.tar.xz
drag to reply (#1018)
Diffstat (limited to 'resources/qml/TimelineRow.qml')
-rw-r--r--resources/qml/TimelineRow.qml28
1 files changed, 27 insertions, 1 deletions
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 947ba030..43de679c 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -5,7 +5,7 @@
 
 import "./delegates"
 import "./emoji"
-import QtQuick 2.12
+import QtQuick 2.15
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
 import QtQuick.Window 2.13
@@ -66,6 +66,32 @@ AbstractButton {
     onPressAndHold: messageContextMenu.show(eventId, type, isSender, isEncrypted, isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
     onDoubleClicked: chat.model.reply = eventId
 
+    DragHandler {
+        id: draghandler
+        yAxis.enabled: false
+        xAxis.maximum: 100
+        xAxis.minimum: -100
+        onActiveChanged: {
+            if(!active && (x < -70 || x > 70))
+                chat.model.reply = eventId
+        }
+    }
+    states: State {
+        name: "dragging"
+        when: draghandler.active
+    }
+    transitions: Transition {
+        from: "dragging"
+        to: ""
+        PropertyAnimation {
+            target: r
+            properties: "x"
+            easing.type: Easing.InOutQuad
+            to: 0
+            duration: 100
+        }
+    }
+
     Rectangle {
         id: row
         property bool bubbleOnRight : isSender && Settings.bubbles