From 24a976e3eedcbe852d1402b2541ad138098da1ad Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 1 Sep 2019 05:16:47 -0400 Subject: [PATCH] Fix clicking on eventList top/bot making it scroll --- src/qml/Base/HSelectableLabelContainer.qml | 4 ++-- src/qml/Chat/Timeline/EventDelegate.qml | 1 + src/qml/Chat/Timeline/EventList.qml | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qml/Base/HSelectableLabelContainer.qml b/src/qml/Base/HSelectableLabelContainer.qml index 3644728e..ea8c3894 100644 --- a/src/qml/Base/HSelectableLabelContainer.qml +++ b/src/qml/Base/HSelectableLabelContainer.qml @@ -54,11 +54,11 @@ FocusScope { } - Item { id: dragPoint } + Item { id: dragCursor } DragHandler { id: dragHandler - target: dragPoint + target: dragCursor onActiveChanged: { if (active) { target.Drag.active = true diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index b4678eab..586ef233 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -44,6 +44,7 @@ Column { combine ? theme.spacing / 2 : theme.spacing * 2 + Daybreak { visible: dayBreak width: eventDelegate.width diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index f177a659..8c1f436f 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -13,6 +13,8 @@ Rectangle { reversed: eventList.verticalLayoutDirection == ListView.BottomToTop onDragPositionChanged: { + let vel = dragPoint.velocity.y + let boost = 20 * ( dragPosition.y < 50 ? -dragPosition.y : -(height - dragPosition.y) @@ -20,8 +22,8 @@ Rectangle { dragFlicker.speed = dragPosition.x == 0 && dragPosition.y == 0 ? 0 : - dragPosition.y < 50 ? 1000 + boost: - dragPosition.y > height - 50 ? -1000 + -boost : + vel && dragPosition.y < 50 ? 1000 + boost: + vel && dragPosition.y > height - 50 ? -1000 + -boost : 0 }