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 }