Fix hover actions being taken away by scrolling
This commit is contained in:
@@ -46,25 +46,30 @@ Item {
|
||||
// show hover actions
|
||||
onHoveredChanged: {
|
||||
if (hovered && !Kirigami.Settings.isMobile) {
|
||||
hoverComponent.parent = controlContainer;
|
||||
hoverComponent.x = Qt.binding(() => controlContainer.width - hoverComponent.childWidth)
|
||||
hoverComponent.y = -Kirigami.Units.largeSpacing * 4
|
||||
hoverComponent.hovered = Qt.binding(() => controlContainer.hovered);
|
||||
hoverComponent.showEdit = author.id === Controller.activeConnection.localUserId && (model.eventType === "emote" || model.eventType === "message");
|
||||
|
||||
hoverComponent.editClicked = () => {
|
||||
if (hoverComponent.showEdit) {
|
||||
edit(message, model.formattedBody, eventId);
|
||||
}
|
||||
};
|
||||
hoverComponent.replyClicked = () => {
|
||||
replyToMessage(author, message, eventId);
|
||||
};
|
||||
hoverComponent.reacted = emoji => {
|
||||
currentRoom.toggleReaction(eventId, emoji);
|
||||
};
|
||||
updateHoverComponent();
|
||||
}
|
||||
}
|
||||
|
||||
// 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.hovered = Qt.binding(() => controlContainer.hovered);
|
||||
hoverComponent.showEdit = author.id === Controller.activeConnection.localUserId && (model.eventType === "emote" || model.eventType === "message");
|
||||
hoverComponent.updateFunction = updateHoverComponent;
|
||||
|
||||
hoverComponent.editClicked = () => {
|
||||
if (hoverComponent.showEdit) {
|
||||
edit(message, model.formattedBody, eventId);
|
||||
}
|
||||
};
|
||||
hoverComponent.replyClicked = () => {
|
||||
replyToMessage(author, message, eventId);
|
||||
};
|
||||
hoverComponent.reacted = emoji => {
|
||||
currentRoom.toggleReaction(eventId, emoji);
|
||||
};
|
||||
}
|
||||
|
||||
DragHandler {
|
||||
enabled: Kirigami.Settings.isMobile
|
||||
|
||||
@@ -129,13 +129,23 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
|
||||
// hover actions on a delegate, activated in TimelineContainer.qml
|
||||
QQC2.Popup {
|
||||
Connections {
|
||||
target: page.flickable
|
||||
function onContentYChanged() {
|
||||
if (hoverActions.visible) {
|
||||
hoverActions.updateFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: hoverActions
|
||||
property bool showEdit
|
||||
property bool hovered: false
|
||||
|
||||
visible: (hovered || hoverHandler.hovered) && !Kirigami.Settings.isMobile
|
||||
|
||||
property var updateFunction
|
||||
|
||||
property var editClicked
|
||||
property var replyClicked
|
||||
property var reacted
|
||||
@@ -143,9 +153,7 @@ Kirigami.ScrollablePage {
|
||||
property alias childWidth: hoverActionsRow.width
|
||||
property alias childHeight: hoverActionsRow.height
|
||||
|
||||
background: Item {}
|
||||
|
||||
contentItem: RowLayout {
|
||||
RowLayout {
|
||||
id: hoverActionsRow
|
||||
z: 4
|
||||
spacing: 0
|
||||
|
||||
Reference in New Issue
Block a user