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.
This commit is contained in:
Levi Neely 2026-07-29 16:49:44 +02:00
parent 32c501a2c7
commit e4c1cea385
2 changed files with 28 additions and 25 deletions

View File

@ -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
}
}

View File

@ -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
}
}