From ba955008fcc224cc1803e4510377f0a6ea27fa2d Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 19 Mar 2020 04:23:09 -0400 Subject: [PATCH] Improve main pane list reactions to mouse events --- src/gui/MainPane/Account.qml | 1 + src/gui/MainPane/AccountRoomsList.qml | 15 +++++++++++++-- src/gui/MainPane/Room.qml | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gui/MainPane/Account.qml b/src/gui/MainPane/Account.qml index a3b54559..f34fd990 100644 --- a/src/gui/MainPane/Account.qml +++ b/src/gui/MainPane/Account.qml @@ -54,6 +54,7 @@ HTileDelegate { "AccountSettings/AccountSettings", { "userId": model.id } ) mainPaneList.detachedCurrentIndex = false + mainPaneList.centerToHighlight = false } diff --git a/src/gui/MainPane/AccountRoomsList.qml b/src/gui/MainPane/AccountRoomsList.qml index bc504d34..d8090a25 100644 --- a/src/gui/MainPane/AccountRoomsList.qml +++ b/src/gui/MainPane/AccountRoomsList.qml @@ -55,18 +55,21 @@ HListView { value: highlightRectangle.y + highlightRectangle.height / 2 - mainPaneList.height / 2 delayed: true - when: yAnimation.running + when: centerToHighlight && yAnimation.running } Connections { target: mainPaneList - enabled: yAnimation.running + enabled: centerToHighlight && yAnimation.running onContentYChanged: mainPaneList.returnToBounds() } } + onMovingChanged: if (moving) centerToHighlight = false + property bool detachedCurrentIndex: false + property bool centerToHighlight: false readonly property Room selectedRoom: currentItem ? currentItem.roomList.currentItem : null @@ -83,6 +86,7 @@ HListView { function previous() { + centerToHighlight = true detachedCurrentIndex = true if (! mainPane.filter) { @@ -129,6 +133,7 @@ HListView { } function next() { + centerToHighlight = true detachedCurrentIndex = true if (! mainPane.filter) { @@ -226,6 +231,12 @@ HListView { when: ! detachedCurrentIndex } + TapHandler { + id: tapHandler + property var pr: active + onPrChanged: print("pr changed:", pr) + } + Timer { id: activateLimiter interval: 200 diff --git a/src/gui/MainPane/Room.qml b/src/gui/MainPane/Room.qml index d5fcc605..80459d13 100644 --- a/src/gui/MainPane/Room.qml +++ b/src/gui/MainPane/Room.qml @@ -150,6 +150,7 @@ HTileDelegate { onActivated: { pageLoader.showRoom(userId, model.id) mainPaneList.detachedCurrentIndex = false + mainPaneList.centerToHighlight = false }