Improve main pane list reactions to mouse events

This commit is contained in:
miruka 2020-03-19 04:23:09 -04:00
parent e86c5d7163
commit ba955008fc
3 changed files with 15 additions and 2 deletions

View File

@ -54,6 +54,7 @@ HTileDelegate {
"AccountSettings/AccountSettings", { "userId": model.id } "AccountSettings/AccountSettings", { "userId": model.id }
) )
mainPaneList.detachedCurrentIndex = false mainPaneList.detachedCurrentIndex = false
mainPaneList.centerToHighlight = false
} }

View File

@ -55,18 +55,21 @@ HListView {
value: highlightRectangle.y + highlightRectangle.height / 2 - value: highlightRectangle.y + highlightRectangle.height / 2 -
mainPaneList.height / 2 mainPaneList.height / 2
delayed: true delayed: true
when: yAnimation.running when: centerToHighlight && yAnimation.running
} }
Connections { Connections {
target: mainPaneList target: mainPaneList
enabled: yAnimation.running enabled: centerToHighlight && yAnimation.running
onContentYChanged: mainPaneList.returnToBounds() onContentYChanged: mainPaneList.returnToBounds()
} }
} }
onMovingChanged: if (moving) centerToHighlight = false
property bool detachedCurrentIndex: false property bool detachedCurrentIndex: false
property bool centerToHighlight: false
readonly property Room selectedRoom: readonly property Room selectedRoom:
currentItem ? currentItem.roomList.currentItem : null currentItem ? currentItem.roomList.currentItem : null
@ -83,6 +86,7 @@ HListView {
function previous() { function previous() {
centerToHighlight = true
detachedCurrentIndex = true detachedCurrentIndex = true
if (! mainPane.filter) { if (! mainPane.filter) {
@ -129,6 +133,7 @@ HListView {
} }
function next() { function next() {
centerToHighlight = true
detachedCurrentIndex = true detachedCurrentIndex = true
if (! mainPane.filter) { if (! mainPane.filter) {
@ -226,6 +231,12 @@ HListView {
when: ! detachedCurrentIndex when: ! detachedCurrentIndex
} }
TapHandler {
id: tapHandler
property var pr: active
onPrChanged: print("pr changed:", pr)
}
Timer { Timer {
id: activateLimiter id: activateLimiter
interval: 200 interval: 200

View File

@ -150,6 +150,7 @@ HTileDelegate {
onActivated: { onActivated: {
pageLoader.showRoom(userId, model.id) pageLoader.showRoom(userId, model.id)
mainPaneList.detachedCurrentIndex = false mainPaneList.detachedCurrentIndex = false
mainPaneList.centerToHighlight = false
} }