drag manager: don't hog input when not interactive

This commit is contained in:
end-4
2025-05-25 22:16:23 +02:00
parent 0ea7d156a5
commit e030fb1282
@@ -29,14 +29,20 @@ MouseArea { // Flick to dismiss
} }
onPressed: (mouse) => { onPressed: (mouse) => {
if (!root.interactive) return; if (!root.interactive) {
mouse.accepted = false;
return;
}
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
startX = mouse.x startX = mouse.x
startY = mouse.y startY = mouse.y
} }
} }
onReleased: (mouse) => { onReleased: (mouse) => {
if (!root.interactive) return; if (!root.interactive) {
mouse.accepted = false;
return;
}
dragging = false dragging = false
root.dragReleased(_dragDiffX, _dragDiffY); root.dragReleased(_dragDiffX, _dragDiffY);
if (root.automaticallyReset) { if (root.automaticallyReset) {
@@ -44,7 +50,10 @@ MouseArea { // Flick to dismiss
} }
} }
onPositionChanged: (mouse) => { onPositionChanged: (mouse) => {
if (!root.interactive) return; if (!root.interactive) {
mouse.accepted = false;
return;
}
if (mouse.buttons & Qt.LeftButton) { if (mouse.buttons & Qt.LeftButton) {
root._dragDiffX = mouse.x - startX root._dragDiffX = mouse.x - startX
root._dragDiffY = mouse.y - startY root._dragDiffY = mouse.y - startY
@@ -54,7 +63,10 @@ MouseArea { // Flick to dismiss
} }
} }
onCanceled: (mouse) => { onCanceled: (mouse) => {
if (!root.interactive) return; if (!root.interactive) {
mouse.accepted = false;
return;
}
released(mouse); released(mouse);
} }
} }