Commit 439ff491 authored by Stefan Dunca's avatar Stefan Dunca

Fix gimbal indicator display

Fix gimbal indicator so that angle values match the markers
Select thermal mode on thermal menu selection
parent 6ebae0ae
......@@ -12,12 +12,18 @@ Item {
property real zoomLevel: NaN
property alias zoomLevelVisible: zoomStatusItem.visible
property bool showZoomPrecision: true
property bool onlyContinousZoom: false
signal zoomIn()
signal zoomOut()
signal continuousZoomStart(var zoomIn)
signal continuousZoomStop()
//
// Beware the buttons were switched
//
//
height: zoomStatusTextItem.height * 2
width: (zoomLevelVisible ? (zoomStatusItem.width - zoomInButton.width/2) : 0) + zoomInButton.width + zoomOutButton.width
......@@ -69,7 +75,12 @@ Item {
property bool holding: false
onPressed: {
_root.zoomIn()
if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomOut()
}
}
onPressAndHold: {
......@@ -82,7 +93,7 @@ Item {
background: Rectangle {
anchors.fill: zoomInButton
radius: zoomInButton.width/2
radius: zoomInButton.width/10
color: _root.mainColor
}
......@@ -96,14 +107,6 @@ Item {
width: zoomInButton.width * 0.4
height: zoomInButton.height * 0.05
color: _root.contentColor
}
Rectangle {
anchors.centerIn: parent
width: zoomInMinusRectangle.height
height: zoomInMinusRectangle.width
color: _root.contentColor
}
}
......@@ -140,7 +143,12 @@ Item {
property bool holding: false
onPressed: {
_root.zoomOut()
if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomIn()
}
}
onPressAndHold: {
......@@ -153,7 +161,7 @@ Item {
background: Rectangle {
anchors.fill: zoomOutButton
radius: zoomOutButton.width/2
radius: zoomOutButton.width/10
color: _root.mainColor
}
......@@ -167,6 +175,14 @@ Item {
width: zoomInMinusRectangle.width
height: zoomInMinusRectangle.height
color: _root.contentColor
}
Rectangle {
anchors.centerIn: parent
width: zoomOutMinusRectangle.height
height: zoomOutMinusRectangle.width
color: _root.contentColor
}
}
......@@ -203,11 +219,11 @@ Item {
},
State {
name: "ZoomingIn"
when: zoomInButton.holding === true
when: zoomOutButton.holding === true
},
State {
name: "ZoomingOut"
when: zoomOutButton.holding === true
when: zoomInButton.holding === true
}
]
}
......@@ -13,6 +13,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import QtQuick.Dialogs 1.3
import QtGraphicalEffects 1.0
import QtMultimedia 5.9
import QtPositioning 5.2
......@@ -31,6 +32,7 @@ import Custom.Widgets 1.0
import Custom.Camera 1.0
Item {
id: _root
height: mainColumn.height
width: mainColumn.width + (ScreenTools.defaultFontPixelWidth * 2)
visible: !QGroundControl.videoManager.fullScreen
......@@ -399,10 +401,11 @@ Item {
}
//-- Gimbal Indicator
Rectangle {
id: gimbalBackground
width: _hasGimbal ? ScreenTools.defaultFontPixelWidth * 6 : 0
height: _hasGimbal ? (gimbalCol.height + (ScreenTools.defaultFontPixelHeight * 2)) : 0
visible: _hasGimbal
color: Qt.rgba(0,0,0,0.5)
color: Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.5)
radius: ScreenTools.defaultFontPixelWidth * 0.5
anchors.verticalCenter: cameraRect.verticalCenter
Column {
......@@ -410,6 +413,7 @@ Item {
spacing: ScreenTools.defaultFontPixelHeight * 0.75
anchors.centerIn: parent
Image {
id: gimbalIcon
source: "/custom/img/gimbal_icon.svg"
width: ScreenTools.defaultFontPixelWidth * 2
height: width
......@@ -418,7 +422,7 @@ Item {
antialiasing: true
fillMode: Image.PreserveAspectFit
sourceSize.width: width
anchors.horizontalCenter: parent.horizontalCenter
z: stickItem.z + 1
}
Image {
id: pitchScale
......@@ -429,34 +433,42 @@ Item {
smooth: true
mipmap: true
antialiasing: true
anchors.horizontalCenter: parent.horizontalCenter
Image {
id: yawIndicator
width: ScreenTools.defaultFontPixelWidth * 4
source: "/custom/img/gimbal_position.svg"
fillMode: Image.PreserveAspectFit
sourceSize.width: width
y: (parent.height * _pitch / 105)
x: pitchScale.width/2
y: (pitchScale.height * pitchScale.scaleRatio) + (pitchScale._pitch / pitchScale.rangeValue) * pitchScale.height
smooth: true
mipmap: true
anchors.horizontalCenter: parent.horizontalCenter
transform: Rotation {
origin.x: yawIndicator.width / 2
origin.y: yawIndicator.height / 2
angle: _gimbalYaw
}
property real _pitch: _gimbalPitch < -15 ? -15 : (_gimbalPitch > 90 ? 90 : _gimbalPitch)
transform: [
Translate {
x: -yawIndicator.width / 2
y: -yawIndicator.height / 2
},
Rotation {
angle: _gimbalYaw
}
]
}
readonly property real minValue: -15
readonly property real centerValue: 0
readonly property real maxValue: 90
readonly property real rangeValue: maxValue - minValue
readonly property real scaleRatio: 1/7
property real _pitch: _gimbalPitch < minValue ? minValue : (_gimbalPitch > maxValue ? maxValue : _gimbalPitch)
}
QGCLabel {
id: gimbalLabel
text: _gimbalPitch ? _gimbalPitch.toFixed(0) : 0
text: _gimbalPitch ? pitchScale._pitch.toFixed(0) : 0
color: "#FFF"
font.pointSize: ScreenTools.smallFontPointSize
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
} // Gimbal Indicator
}
//-- Zoom Buttons
ZoomControl {
......@@ -468,6 +480,7 @@ Item {
zoomLevelVisible: false
zoomLevel: _hasZoom ? _camera.zoomLevel : NaN
anchors.horizontalCenter: parent.horizontalCenter
onlyContinousZoom: true
onZoomIn: {
_camera.stepZoom(1)
}
......@@ -940,18 +953,18 @@ Item {
id: thermalPalettes
width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40)
height: mainWindow.height * 0.5
//modal: true
modal: true
focus: true
parent: Overlay.overlay
x: Math.round((mainWindow.width - width) * 0.5)
y: Math.round((mainWindow.height - height) * 0.5)
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property int selectedIndex: 0
background: Rectangle {
anchors.fill: parent
color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75)
border.color: qgcPal.text
radius: ScreenTools.defaultFontPixelWidth
radius: ScreenTools.defaultFontPixelWidth * 0.5
}
Item {
anchors.fill: parent
......@@ -987,6 +1000,7 @@ Item {
if(thermalBackgroundRect.visible) {
if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) {
_camera.thermalMode = QGCCameraControl.THERMAL_FULL
thermalFull.checked = true
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment