From e4c1cea38585f6f3d48eda73eec3975c59682da9 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Wed, 29 Jul 2026 16:49:44 +0200 Subject: [PATCH] diagrams: move MouseArea outside Flickable to fix pan Child MouseArea inside Flickable interferes with drag detection even when only accepting RightButton. Move it to a sibling overlay with propagateComposedEvents so left-drag reaches the Flickable natively. --- gui/ChatPane.qml | 27 ++++++++++++++------------- gui/main-kf5.qml | 26 ++++++++++++++------------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/gui/ChatPane.qml b/gui/ChatPane.qml index 7a85ac8..2aff4b8 100644 --- a/gui/ChatPane.qml +++ b/gui/ChatPane.qml @@ -1477,23 +1477,24 @@ Item { cache: false property real zoomFactor: 1.0 - // sourceSize gives us intrinsic dimensions; scale from Flickable size width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor) height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor) } + } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton - onClicked: function(mouse) { - if (mouse.button === Qt.RightButton) - diagramFullscreen.close() - } - onWheel: function(wheel) { - let factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87 - let newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor)) - diagramZoomImg.zoomFactor = newZoom - } + // Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference) + MouseArea { + anchors.fill: diagramFlick + acceptedButtons: Qt.RightButton + propagateComposedEvents: true + onClicked: function(mouse) { + if (mouse.button === Qt.RightButton) + diagramFullscreen.close() + } + onWheel: function(wheel) { + let factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87 + let newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor)) + diagramZoomImg.zoomFactor = newZoom } } diff --git a/gui/main-kf5.qml b/gui/main-kf5.qml index 81055cc..ab9f73b 100644 --- a/gui/main-kf5.qml +++ b/gui/main-kf5.qml @@ -2290,19 +2290,21 @@ ApplicationWindow { width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor) height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor) } + } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton - onClicked: function(mouse) { - if (mouse.button === Qt.RightButton) - diagramFullscreen.close() - } - onWheel: function(wheel) { - var factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87 - var newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor)) - diagramZoomImg.zoomFactor = newZoom - } + // Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference) + MouseArea { + anchors.fill: diagramFlick + acceptedButtons: Qt.RightButton + propagateComposedEvents: true + onClicked: function(mouse) { + if (mouse.button === Qt.RightButton) + diagramFullscreen.close() + } + onWheel: function(wheel) { + var factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87 + var newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor)) + diagramZoomImg.zoomFactor = newZoom } }