Skip to content

Commit

Permalink
components: Compass: Fix head up
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Oct 21, 2023
1 parent 3d34a72 commit c30c36c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/widgets/Compass.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const renderCanvas = (): void => {
ctx.rotate(radians(-90))
// Draw line and identification for each cardinal and sub-cardinal angle
if (widget.value.options.headingStyle == HeadingStyle.HEAD_UP) {
ctx.rotate(radians(renderVariables.yawAngleDegrees))
}
for (const [angleDegrees, angleName] of Object.entries(mainAngles)) {
ctx.save()
Expand Down Expand Up @@ -157,7 +160,11 @@ const renderCanvas = (): void => {
ctx.stroke()
// Draw central indicator
ctx.rotate(radians(renderVariables.yawAngleDegrees))
if (widget.value.options.headingStyle == HeadingStyle.NORTH_UP) {
ctx.rotate(radians(renderVariables.yawAngleDegrees))
} else {
ctx.rotate(-radians(renderVariables.yawAngleDegrees))
}
ctx.beginPath()
ctx.lineWidth = 1
ctx.strokeStyle = 'red'
Expand Down

0 comments on commit c30c36c

Please sign in to comment.