Skip to content

Commit

Permalink
virtual-horizon: fixed issue with roll axis rendered backwards. fixed…
Browse files Browse the repository at this point in the history
… issue with horizon not visable until vehicle moves
  • Loading branch information
ericjohnson97 authored and patrickelectric committed Mar 2, 2024
1 parent 911bb94 commit 33e02ef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/widgets/VirtualHorizon.vue
Expand Up @@ -12,7 +12,7 @@
<script setup lang="ts">
import { useElementSize } from '@vueuse/core'
import gsap from 'gsap'
import { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'
import { computed, nextTick, onMounted, reactive, ref, toRefs, watch } from 'vue'
import { datalogger, DatalogVariable } from '@/libs/sensors-logging'
import { degrees, radians, resetCanvas } from '@/libs/utils'
Expand Down Expand Up @@ -237,14 +237,20 @@ watch(pitchAngleDeg, () => {
})
watch(rollAngleDeg, () => {
gsap.to(renderVariables, 0.1, { rollAngleDegrees: rollAngleDeg.value })
gsap.to(renderVariables, 0.1, { rollAngleDegrees: -1 * rollAngleDeg.value })
})
// Update canvas whenever reference variables changes
watch(renderVariables, () => {
if (!widgetStore.isWidgetVisible(widget.value)) return
nextTick(() => renderCanvas())
})
onMounted(() => {
if (canvasRef.value === undefined || canvasRef.value === null) return
if (canvasContext.value === undefined) canvasContext.value = canvasRef.value.getContext('2d')
renderCanvas()
})
</script>

<style scoped>
Expand Down

0 comments on commit 33e02ef

Please sign in to comment.