mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
PFD qml: align elements to pixels grid
It improves the rendering quality, sub pixels accuracy gives no benefits in placing PFD elements
This commit is contained in:
parent
a8e6f4991b
commit
150314ff98
@ -12,10 +12,8 @@ Item {
|
||||
|
||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-bg")
|
||||
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
width: scaledBounds.width * sceneItem.width
|
||||
height: scaledBounds.height * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
|
||||
SvgElementImage {
|
||||
id: altitude_scale
|
||||
|
@ -12,8 +12,8 @@ Item {
|
||||
|
||||
clip: true
|
||||
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
//split compass band to 8 parts to ensure it doesn't exceed the max texture size
|
||||
|
@ -13,10 +13,8 @@ Item {
|
||||
property string statusName : ["Disconnected","HandshakeReq","HandshakeAck","Connected"][GCSTelemetryStats.Status]
|
||||
|
||||
scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gcstelemetry-Disconnected")
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
width: scaledBounds.width * sceneItem.width
|
||||
height: scaledBounds.height * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
}
|
||||
|
||||
//telemetry rate text
|
||||
@ -41,8 +39,8 @@ Item {
|
||||
visible: GPSPosition.Satellites > 0
|
||||
|
||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gps-txt")
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
}
|
||||
|
||||
Text {
|
||||
@ -63,8 +61,7 @@ Item {
|
||||
visible: FlightBatteryState.Voltage > 0 || FlightBatteryState.Current > 0
|
||||
|
||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "battery-txt")
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ Item {
|
||||
smooth: true
|
||||
|
||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "world")
|
||||
width: sceneItem.width*scaledBounds.width
|
||||
height: sceneItem.height*scaledBounds.height
|
||||
width: Math.round(sceneItem.width*scaledBounds.width/2)*2
|
||||
height: Math.round(sceneItem.height*scaledBounds.height/2)*2
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.3; color: "#6589E2" }
|
||||
@ -21,8 +21,9 @@ Item {
|
||||
transform: [
|
||||
Translate {
|
||||
id: pitchTranslate
|
||||
x: (world.parent.width - world.width)/2
|
||||
y: (world.parent.height - world.height)/2 + AttitudeActual.Pitch*world.parent.height/94
|
||||
x: Math.round((world.parent.width - world.width)/2)
|
||||
y: Math.round((world.parent.height - world.height)/2 +
|
||||
AttitudeActual.Pitch*world.parent.height/94)
|
||||
},
|
||||
Rotation {
|
||||
angle: -AttitudeActual.Roll
|
||||
|
@ -12,10 +12,8 @@ Item {
|
||||
sceneSize: sceneItem.sceneSize
|
||||
clip: true
|
||||
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
width: scaledBounds.width * sceneItem.width
|
||||
height: scaledBounds.height * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
|
||||
SvgElementImage {
|
||||
id: speed_scale
|
||||
|
@ -10,10 +10,8 @@ Item {
|
||||
sceneSize: sceneItem.sceneSize
|
||||
clip: true
|
||||
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
width: scaledBounds.width * sceneItem.width
|
||||
height: scaledBounds.height * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
|
||||
SvgElementImage {
|
||||
id: vsi_bar
|
||||
@ -73,9 +71,7 @@ Item {
|
||||
elementName: "vsi-window"
|
||||
sceneSize: sceneItem.sceneSize
|
||||
|
||||
x: scaledBounds.x * sceneItem.width
|
||||
y: scaledBounds.y * sceneItem.height
|
||||
width: scaledBounds.width * sceneItem.width
|
||||
height: scaledBounds.height * sceneItem.height
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user