Fix hover actions being taken away by scrolling
This commit is contained in:
@@ -46,25 +46,30 @@ Item {
|
|||||||
// show hover actions
|
// show hover actions
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (hovered && !Kirigami.Settings.isMobile) {
|
if (hovered && !Kirigami.Settings.isMobile) {
|
||||||
hoverComponent.parent = controlContainer;
|
updateHoverComponent();
|
||||||
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);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 {
|
DragHandler {
|
||||||
enabled: Kirigami.Settings.isMobile
|
enabled: Kirigami.Settings.isMobile
|
||||||
|
|||||||
@@ -129,13 +129,23 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hover actions on a delegate, activated in TimelineContainer.qml
|
// 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
|
id: hoverActions
|
||||||
property bool showEdit
|
property bool showEdit
|
||||||
property bool hovered: false
|
property bool hovered: false
|
||||||
|
|
||||||
visible: (hovered || hoverHandler.hovered) && !Kirigami.Settings.isMobile
|
visible: (hovered || hoverHandler.hovered) && !Kirigami.Settings.isMobile
|
||||||
|
|
||||||
|
property var updateFunction
|
||||||
|
|
||||||
property var editClicked
|
property var editClicked
|
||||||
property var replyClicked
|
property var replyClicked
|
||||||
property var reacted
|
property var reacted
|
||||||
@@ -143,9 +153,7 @@ Kirigami.ScrollablePage {
|
|||||||
property alias childWidth: hoverActionsRow.width
|
property alias childWidth: hoverActionsRow.width
|
||||||
property alias childHeight: hoverActionsRow.height
|
property alias childHeight: hoverActionsRow.height
|
||||||
|
|
||||||
background: Item {}
|
RowLayout {
|
||||||
|
|
||||||
contentItem: RowLayout {
|
|
||||||
id: hoverActionsRow
|
id: hoverActionsRow
|
||||||
z: 4
|
z: 4
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user