From 6f557c19a1785d698f42ec2e4a68b15f6ceac7aa Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 25 Jul 2020 22:57:54 +0200 Subject: [PATCH] Optimize scrolling a little bit --- resources/qml/MatrixText.qml | 3 --- resources/qml/ScrollHelper.qml | 2 +- resources/qml/TimelineView.qml | 49 +++++++++++++++++----------------- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml index c83069ec..9a4f7348 100644 --- a/resources/qml/MatrixText.qml +++ b/resources/qml/MatrixText.qml @@ -8,9 +8,6 @@ TextEdit { selectByMouse: true color: colors.text - font.hintingPreference: Font.PreferFullHinting - renderType: Text.NativeRendering - onLinkActivated: { if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) chat.model.openUserProfile(/^https:\/\/matrix.to\/#\/(@.*)$/.exec(link)[1]) else if (/^https:\/\/matrix.to\/#\/(![^\/]*)$/.test(link)) timelineManager.setHistoryView(/^https:\/\/matrix.to\/#\/(!.*)$/.exec(link)[1]) diff --git a/resources/qml/ScrollHelper.qml b/resources/qml/ScrollHelper.qml index e72fcbd2..ba7c2648 100644 --- a/resources/qml/ScrollHelper.qml +++ b/resources/qml/ScrollHelper.qml @@ -106,6 +106,6 @@ MouseArea { //How long the scrollbar will remain visible interval: 500 // Hide the scrollbars - onTriggered: flickable.cancelFlick(); + onTriggered: { flickable.cancelFlick(); flickable.movementEnded(); } } } diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index da783a7b..7bdeb01f 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -27,16 +27,16 @@ Page { id: fontMetrics } - EmojiPicker { - id: emojiPopup - width: 7 * 52 + 20 - height: 6 * 52 - colors: palette - model: EmojiProxyModel { - category: EmojiCategory.People - sourceModel: EmojiModel {} - } - } + EmojiPicker { + id: emojiPopup + width: 7 * 52 + 20 + height: 6 * 52 + colors: palette + model: EmojiProxyModel { + category: EmojiCategory.People + sourceModel: EmojiModel {} + } + } Menu { id: messageContextMenu @@ -114,7 +114,7 @@ Page { ListView { id: chat - visible: !!timelineManager.timeline + visible: !!timelineManager.timeline cacheBuffer: 400 @@ -206,14 +206,13 @@ Page { } } - Binding { - target: chat.model - property: "currentIndex" - when: y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height - value: index - delayed: true + Connections { + target: chat + function onMovementEnded() { + if (y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height) + chat.model.currentIndex = index; + } } - } section { @@ -296,13 +295,13 @@ Page { } } - footer: BusyIndicator { - anchors.horizontalCenter: parent.horizontalCenter - running: chat.model && chat.model.paginationInProgress - height: 50 - width: 50 - z: 3 - } + footer: BusyIndicator { + anchors.horizontalCenter: parent.horizontalCenter + running: chat.model && chat.model.paginationInProgress + height: 50 + width: 50 + z: 3 + } } Rectangle {