From 546e330e50a7e4550a3f3f65ce26247627901fa9 Mon Sep 17 00:00:00 2001 From: Christian MOTELET <31212553+cmotelet@users.noreply.github.com> Date: Sun, 4 Apr 2021 11:32:02 +0200 Subject: [PATCH] fix: missing convert function in attitude widget (#192) --- lib/ui/widgets/attitude.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ui/widgets/attitude.js b/lib/ui/widgets/attitude.js index 3e93b08..70e95d6 100644 --- a/lib/ui/widgets/attitude.js +++ b/lib/ui/widgets/attitude.js @@ -1,6 +1,7 @@ import React from 'react'; import { render } from 'react-dom'; import util from 'util'; +import Qty from 'js-quantities' import BaseWidget, {defaultComponentDidMount, defaultComponentWillUnmount} from './basewidget'; @@ -11,6 +12,8 @@ const defaultValue = { roll: defaultText } +let convertRadToDeg = Qty.swiftConverter('rad', 'deg') + function Attitude(id, options, streamBundle, instrumentPanel) { BaseWidget.call(this, id, options, streamBundle, instrumentPanel); class ReactComponent extends React.Component { @@ -78,7 +81,7 @@ Attitude.prototype.getInitialDimensions = function() { function convertAndRound(value) { return (typeof value === 'number') ? - convert(value).toFixed(4) + '°' : defaultText + convertRadToDeg(value).toFixed(4) + '°' : defaultText }