perf(chatScroll): Optimize StatusTextMessage size and hover binding for the delegate

This commit is contained in:
Alex Jbanca 2023-01-10 14:07:24 +02:00 committed by Alex Jbanca
parent 2723ef1293
commit 27bb6bf665
2 changed files with 5 additions and 7 deletions

View File

@ -20,13 +20,12 @@ Item {
signal linkActivated(string link)
implicitWidth: chatText.implicitWidth
implicitHeight: chatText.effectiveHeight + d.showMoreHeight
implicitHeight: chatText.height + d.showMoreHeight / 2
QtObject {
id: d
property bool readMore: false
property bool isQuote: false
readonly property bool veryLongChatText: chatText.length > 1000
readonly property int showMoreHeight: showMoreButtonLoader.visible ? showMoreButtonLoader.height : 0
readonly property string text: {
@ -77,8 +76,8 @@ Item {
id: chatText
objectName: "StatusTextMessage_chatText"
readonly property int effectiveHeight: d.veryLongChatText && !d.readMore
? Math.min(chatText.implicitHeight, 200)
readonly property int effectiveHeight: showMoreButtonLoader.active && !d.readMore
? 200
: chatText.implicitHeight
width: parent.width
@ -86,7 +85,6 @@ Item {
anchors.left: parent.left
anchors.leftMargin: d.isQuote ? 8 : 0
opacity: !showMoreOpacityMask.active && !horizontalOpacityMask.active ? 1 : 0
clip: true
text: d.text
selectedTextColor: Theme.palette.directColor1
selectionColor: Theme.palette.primaryColor3
@ -164,7 +162,7 @@ Item {
Loader {
id: showMoreButtonLoader
active: root.allowShowMore && d.veryLongChatText
active: root.allowShowMore && chatText.implicitHeight > 200
visible: active
anchors.verticalCenter: chatText.bottom
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -461,7 +461,7 @@ Loader {
topPadding: showHeader ? Style.current.halfPadding : 2
bottomPadding: showHeader && nextMessageHasHeader() ? Style.current.halfPadding : 2
disableHover: root.disableHover ||
(root.chatLogView && root.chatLogView.flickingVertically) ||
(root.chatLogView && root.chatLogView.moving) ||
(root.messageContextMenu && root.messageContextMenu.opened) ||
Global.profilePopupOpened ||
Global.popupOpened