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