5import QGroundControl.Controls
7// This item can be dragged around within its parent.
8// Double click issues a signal the parent can use to
9// reset its default position.
13 property bool allowDragging: true
14 property real minimumWidth: ScreenTools.defaultFontPixelHeight * (5)
15 property real minimumHeight: ScreenTools.defaultFontPixelHeight * (5)
16 property alias tForm: tform
17 signal resetRequested()
22 property double factor: 25
23 enabled: root.allowDragging
24 cursorShape: Qt.OpenHandCursor
27 drag.axis: Drag.XAndYAxis
30 drag.maximumX: root.parent.width - (root.width * tform.xScale)
31 drag.maximumY: root.parent.height - (root.height * tform.yScale)
32 drag.filterChildren: true
33 onPressed: (mouse) => {
34 root.anchors.left = undefined
35 root.anchors.right = undefined
38 root.resetRequested();
43 if(wheel.angleDelta.y > 0)
44 zoomFactor = 1 + (1/factor)
46 zoomFactor = 1 - (1/factor)
47 var realX = wheel.x * tform.xScale
48 var realY = wheel.y * tform.yScale
49 var tx = root.x + (1-zoomFactor)*realX
50 var ty = root.y + (1-zoomFactor)*realY
53 var ts = tform.xScale * zoomFactor
54 if(root.width * ts >= root.minimumWidth) {
55 if(root.height * ts >= root.minimumHeight) {
56 if(((root.width * ts) + tx) < root.parent.width && ((root.height * ts) + ty) < root.parent.height) {