Refactor hoverActions positioning

The positions are still bad, but the calculation is slightly less ugly
This commit is contained in:
Tobias Fella
2021-04-09 22:51:28 +02:00
parent 71fcc20943
commit 41b53b5245
2 changed files with 2 additions and 6 deletions

View File

@@ -37,9 +37,6 @@ QQC2.ItemDelegate {
//height: mainColumn.childrenRect.height + (readMarker ? Kirigami.Units.smallSpacing : 0)
//height: mainColumn.implicitHeight + (readMarker ? Kirigami.Units.smallSpacing : 0)
property int hoverComponentX: column.width - hoverComponent.childWidth + Kirigami.Units.largeSpacing
property int hoverComponentY: -Kirigami.Units.largeSpacing - hoverComponent.childHeight * 1.5
// show hover actions
onHoveredChanged: {
if (hovered && !Kirigami.Settings.isMobile) {
@@ -49,8 +46,6 @@ QQC2.ItemDelegate {
// updates the global hover component to point to this delegate, and update its position
function updateHoverComponent() {
hoverComponent.x = column.mapToItem(page, hoverComponentX, hoverComponentY).x;
hoverComponent.y = column.mapToItem(page, hoverComponentX, hoverComponentY).y;
hoverComponent.bubble = controlContainer
hoverComponent.updateFunction = updateHoverComponent;
hoverComponent.event = model

View File

@@ -140,7 +140,8 @@ Kirigami.ScrollablePage {
property bool showEdit: event && (event.author.id === Controller.activeConnection.localUserId && (event.eventType === "emote" || event.eventType === "message"))
property var bubble
property var hovered: bubble && bubble.hovered
x: bubble.x + Kirigami.Units.largeSpacing + Math.max(bubble.width - childWidth, 0)
y: bubble.mapToItem(page, 0, -Kirigami.Units.largeSpacing - hoverActions.childHeight * 1.5).y
visible: (hovered || hoverHandler.hovered) && !Kirigami.Settings.isMobile
property var updateFunction