mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
63 lines
1.5 KiB
QML
63 lines
1.5 KiB
QML
import QtQuick 2.0
|
|
import "."
|
|
|
|
Item {
|
|
id: sceneItem
|
|
property variant sceneSize
|
|
|
|
SvgElementImage {
|
|
id: compass_fixed
|
|
elementName: "compass-fixed"
|
|
sceneSize: sceneItem.sceneSize
|
|
|
|
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
}
|
|
|
|
SvgElementImage {
|
|
id: compass_plane
|
|
elementName: "compass-plane"
|
|
sceneSize: sceneItem.sceneSize
|
|
|
|
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
}
|
|
|
|
SvgElementImage {
|
|
id: compass_wheel
|
|
elementName: "compass-wheel"
|
|
sceneSize: sceneItem.sceneSize
|
|
|
|
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
|
|
rotation: -AttitudeState.Yaw
|
|
transformOrigin: Item.Center
|
|
|
|
smooth: true
|
|
}
|
|
|
|
Item {
|
|
id: compass_text_box
|
|
|
|
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "compass-text")
|
|
|
|
x: scaledBounds.x * sceneItem.width
|
|
y: scaledBounds.y * sceneItem.height
|
|
width: scaledBounds.width * sceneItem.width
|
|
height: scaledBounds.height * sceneItem.height
|
|
|
|
Text {
|
|
id: compass_text
|
|
text: Math.floor(AttitudeState.Yaw).toFixed()
|
|
color: "white"
|
|
font {
|
|
family: "Arial"
|
|
pixelSize: parent.height * 1.2
|
|
}
|
|
anchors.centerIn: parent
|
|
}
|
|
}
|
|
|
|
}
|