From c3a5a767c2ffda7726a811e55f3791a814f6d257 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 6 Jul 2022 20:24:24 +0100 Subject: [PATCH] Fix alignment of hover buttons when user message on the right is thin. In this case the buttons sould align to the right of the message not the left so they don't go off screen. --- imports/NeoChat/Page/RoomPage.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 775fb85f2..7e3fc752d 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -408,7 +408,8 @@ Kirigami.ScrollablePage { Item { id: hoverActions property var event: null - property bool showEdit: event && (event.author.id === Controller.activeConnection.localUserId && (event.eventType === "emote" || event.eventType === "message")) + property bool userMsg: event.author.id === Controller.activeConnection.localUserId + property bool showEdit: event && (userMsg && (event.eventType === "emote" || event.eventType === "message")) property var delegate: null property var bubble: null property var hovered: bubble && bubble.hovered @@ -425,7 +426,9 @@ Kirigami.ScrollablePage { interval: 200 onTriggered: hoverActions.visible = hoverActions.visibleDelayed; } - x: delegate && bubble ? (delegate.x + bubble.x + Kirigami.Units.largeSpacing + Math.max(bubble.width - childWidth, 0) - (Config.compactLayout ? Kirigami.Units.gridUnit * 3 : 0)) : 0 + + property int childOffset: userMsg && Config.showLocalMessagesOnRight && !Config.compactLayout ? bubble.width - childWidth : Math.max(bubble.width - childWidth, 0) + x: delegate && bubble ? (delegate.x + bubble.x + Kirigami.Units.largeSpacing + childOffset - (Config.compactLayout ? Kirigami.Units.gridUnit * 3 : 0)) : 0 y: bubble ? bubble.mapToItem(parent, 0, 0).y - hoverActions.childHeight + Kirigami.Units.smallSpacing: 0; visible: false