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:
parent
32c501a2c7
commit
e4c1cea385
|
|
@ -1477,23 +1477,24 @@ Item {
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
property real zoomFactor: 1.0
|
property real zoomFactor: 1.0
|
||||||
// sourceSize gives us intrinsic dimensions; scale from Flickable size
|
|
||||||
width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor)
|
width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor)
|
||||||
height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor)
|
height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
// Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference)
|
||||||
anchors.fill: parent
|
MouseArea {
|
||||||
acceptedButtons: Qt.RightButton
|
anchors.fill: diagramFlick
|
||||||
onClicked: function(mouse) {
|
acceptedButtons: Qt.RightButton
|
||||||
if (mouse.button === Qt.RightButton)
|
propagateComposedEvents: true
|
||||||
diagramFullscreen.close()
|
onClicked: function(mouse) {
|
||||||
}
|
if (mouse.button === Qt.RightButton)
|
||||||
onWheel: function(wheel) {
|
diagramFullscreen.close()
|
||||||
let factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87
|
}
|
||||||
let newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor))
|
onWheel: function(wheel) {
|
||||||
diagramZoomImg.zoomFactor = newZoom
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2290,19 +2290,21 @@ ApplicationWindow {
|
||||||
width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor)
|
width: Math.max(diagramFlick.width, diagramFlick.width * zoomFactor)
|
||||||
height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor)
|
height: Math.max(diagramFlick.height, diagramFlick.height * zoomFactor)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
// Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference)
|
||||||
anchors.fill: parent
|
MouseArea {
|
||||||
acceptedButtons: Qt.RightButton
|
anchors.fill: diagramFlick
|
||||||
onClicked: function(mouse) {
|
acceptedButtons: Qt.RightButton
|
||||||
if (mouse.button === Qt.RightButton)
|
propagateComposedEvents: true
|
||||||
diagramFullscreen.close()
|
onClicked: function(mouse) {
|
||||||
}
|
if (mouse.button === Qt.RightButton)
|
||||||
onWheel: function(wheel) {
|
diagramFullscreen.close()
|
||||||
var factor = wheel.angleDelta.y > 0 ? 1.15 : 0.87
|
}
|
||||||
var newZoom = Math.max(0.25, Math.min(10.0, diagramZoomImg.zoomFactor * factor))
|
onWheel: function(wheel) {
|
||||||
diagramZoomImg.zoomFactor = newZoom
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue