From 7a658a5fe04221d087a84538b68cf907394daec2 Mon Sep 17 00:00:00 2001 From: DieBorr Date: Fri, 26 May 2023 12:59:07 +0200 Subject: [PATCH] VirtualJoystick: Fix stick position while screen size changes Resolve of mavlink#10666, while the QGC window is resizing, both virtual joysticks are not centered causing dangerous behavior. Now, if the screen size is changed, both joysticks will be centered while the screen resize is stopped. --- src/QmlControls/JoystickThumbPad.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/QmlControls/JoystickThumbPad.qml b/src/QmlControls/JoystickThumbPad.qml index 179aea8..ae9ec80 100644 --- a/src/QmlControls/JoystickThumbPad.qml +++ b/src/QmlControls/JoystickThumbPad.qml @@ -28,11 +28,18 @@ Item { QGCMapPalette { id: mapPal } - onWidthChanged: calculateXAxis() onStickPositionXChanged: calculateXAxis() - onHeightChanged: calculateYAxis() onStickPositionYChanged: calculateYAxis() onYAxisPositiveRangeOnlyChanged: calculateYAxis() + onHeightChanged: { + calculateYAxis() + reCenter() + } + onWidthChanged: { + calculateXAxis() + reCenter() + } + //We prevent Joystick to move while the screen is resizing function calculateXAxis() { if(!_joyRoot.visible) {