Refactor hoverActions positioning
The positions are still bad, but the calculation is slightly less ugly
This commit is contained in:
@@ -37,9 +37,6 @@ QQC2.ItemDelegate {
|
|||||||
//height: mainColumn.childrenRect.height + (readMarker ? Kirigami.Units.smallSpacing : 0)
|
//height: mainColumn.childrenRect.height + (readMarker ? Kirigami.Units.smallSpacing : 0)
|
||||||
//height: mainColumn.implicitHeight + (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
|
// show hover actions
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (hovered && !Kirigami.Settings.isMobile) {
|
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
|
// updates the global hover component to point to this delegate, and update its position
|
||||||
function updateHoverComponent() {
|
function updateHoverComponent() {
|
||||||
hoverComponent.x = column.mapToItem(page, hoverComponentX, hoverComponentY).x;
|
|
||||||
hoverComponent.y = column.mapToItem(page, hoverComponentX, hoverComponentY).y;
|
|
||||||
hoverComponent.bubble = controlContainer
|
hoverComponent.bubble = controlContainer
|
||||||
hoverComponent.updateFunction = updateHoverComponent;
|
hoverComponent.updateFunction = updateHoverComponent;
|
||||||
hoverComponent.event = model
|
hoverComponent.event = model
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ Kirigami.ScrollablePage {
|
|||||||
property bool showEdit: event && (event.author.id === Controller.activeConnection.localUserId && (event.eventType === "emote" || event.eventType === "message"))
|
property bool showEdit: event && (event.author.id === Controller.activeConnection.localUserId && (event.eventType === "emote" || event.eventType === "message"))
|
||||||
property var bubble
|
property var bubble
|
||||||
property var hovered: bubble && bubble.hovered
|
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
|
visible: (hovered || hoverHandler.hovered) && !Kirigami.Settings.isMobile
|
||||||
|
|
||||||
property var updateFunction
|
property var updateFunction
|
||||||
|
|||||||
Reference in New Issue
Block a user