From 5078bdd14f5a3b521b1f7a6541c7b5875af61fc1 Mon Sep 17 00:00:00 2001 From: Malte E <97891689+maltee1@users.noreply.github.com> Date: Sun, 27 Mar 2022 21:23:40 +0200 Subject: [PATCH] drag to reply (#1018) --- resources/qml/TimelineRow.qml | 28 ++++++++++++++++++++- resources/qml/TimelineView.qml | 1 + resources/qml/components/AdaptiveLayout.qml | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) 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 diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index c4820077..023de8f0 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -23,6 +23,7 @@ Item { property var room: null property var roomPreview: null property bool showBackButton: false + clip: true Label { visible: !room && !TimelineManager.isInitialSync && (!roomPreview || !roomPreview.roomid) diff --git a/resources/qml/components/AdaptiveLayout.qml b/resources/qml/components/AdaptiveLayout.qml index 28befe91..8e3c0e3d 100644 --- a/resources/qml/components/AdaptiveLayout.qml +++ b/resources/qml/components/AdaptiveLayout.qml @@ -131,6 +131,7 @@ Container { interactive: singlePageMode highlightMoveDuration: container.singlePageMode ? 200 : 0 currentIndex: container.singlePageMode ? container.pageIndex : 0 + boundsBehavior: Flickable.StopAtBounds } }