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,14 +1477,16 @@ 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)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference)
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: diagramFlick
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
propagateComposedEvents: true
|
||||||
onClicked: function(mouse) {
|
onClicked: function(mouse) {
|
||||||
if (mouse.button === Qt.RightButton)
|
if (mouse.button === Qt.RightButton)
|
||||||
diagramFullscreen.close()
|
diagramFullscreen.close()
|
||||||
|
|
@ -1495,7 +1497,6 @@ Item {
|
||||||
diagramZoomImg.zoomFactor = newZoom
|
diagramZoomImg.zoomFactor = newZoom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
diagramZoomImg.zoomFactor = 1.0
|
diagramZoomImg.zoomFactor = 1.0
|
||||||
|
|
|
||||||
|
|
@ -2290,10 +2290,13 @@ 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)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overlay for wheel zoom and right-click close (outside Flickable to avoid drag interference)
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: diagramFlick
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
propagateComposedEvents: true
|
||||||
onClicked: function(mouse) {
|
onClicked: function(mouse) {
|
||||||
if (mouse.button === Qt.RightButton)
|
if (mouse.button === Qt.RightButton)
|
||||||
diagramFullscreen.close()
|
diagramFullscreen.close()
|
||||||
|
|
@ -2304,7 +2307,6 @@ ApplicationWindow {
|
||||||
diagramZoomImg.zoomFactor = newZoom
|
diagramZoomImg.zoomFactor = newZoom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
diagramZoomImg.zoomFactor = 1.0
|
diagramZoomImg.zoomFactor = 1.0
|
||||||
|
|
|
||||||
Reference in New Issue