1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 19:40:22 +03:00

Add hover description for unit names.

Initial coding. Will wait for https://github.com/iNavFlight/inav-configurator/pull/1535 to be merged, so it can be included in this.
This commit is contained in:
Darren Lines 2022-05-30 21:06:08 +01:00
parent 2ea16bdddf
commit 61a808db89

View file

@ -233,14 +233,14 @@ var Settings = (function () {
const oldValue = element.val(); const oldValue = element.val();
//display names for the units // Display names for the units
const unitDisplayDames = { const unitDisplayNames = {
// Misc // Misc
'us' : "uS",
'cw' : 'cW', 'cw' : 'cW',
'percent' : '%', 'percent' : '%',
'cmss' : 'cm/s/s', 'cmss' : 'cm/s/s',
// Time // Time
'us' : "uS",
'msec' : 'ms', 'msec' : 'ms',
'msec-nc' : 'ms', // Milliseconds, but not converted. 'msec-nc' : 'ms', // Milliseconds, but not converted.
'dsec' : 'ds', 'dsec' : 'ds',
@ -275,6 +275,46 @@ var Settings = (function () {
'nm' : 'NM' 'nm' : 'NM'
} }
// Hover full descriptions for the units
const unitExpandedNames = {
// Misc
'cw' : 'CentiWatts',
'percent' : 'Percent',
'cmss' : 'Centimetres per second, per second',
// Time
'us' : "Microseconds",
'msec' : 'Milliseconds',
'dsec' : 'Deciseconds',
'sec' : 'Seconds',
// Angles
'deg' : 'Degrees',
'decideg' : 'Decidegrees',
'decideg-lrg' : 'Decidegrees',
// Rotational speed
'degps' : 'Degrees per second',
'decadegps' : 'Decadegrees per second',
// Temperature
'decidegc' : 'Decidegrees Celsius',
'degc' : 'Degrees Celsius',
'degf' : 'Degrees Fahrenheit',
// Speed
'cms' : 'Centimetres per second',
'v-cms' : 'Centimetres per second',
'ms' : 'Metres per second',
'kmh' : 'Kilometres per hour',
'mph' : 'Miles per hour',
'hftmin' : 'Hundred feet per minute',
'fts' : 'Feet per second',
'kt' : 'Knots',
// Distance
'cm' : 'Centimetres',
'm' : 'Metres',
'km' : 'Kilometres',
'm-lrg' : 'Metres',
'ft' : 'Feet',
'mi' : 'Miles',
'nm' : 'Nautical Miles'
}
// Ensure we can do conversions // Ensure we can do conversions
if (!inputUnit || !oldValue || !element) { if (!inputUnit || !oldValue || !element) {
@ -463,7 +503,7 @@ var Settings = (function () {
element.data('setting-multiplier', multiplier); element.data('setting-multiplier', multiplier);
// Now wrap the input in a display that shows the unit // Now wrap the input in a display that shows the unit
element.wrap(`<div data-unit="${unitDisplayDames[unitName]}" class="unit_wrapper unit"></div>`); element.wrap(`<div data-unit="${unitDisplayNames[unitName]}" title="${unitExpandedNames[unitName]}" class="unit_wrapper unit"></div>`);
function toFahrenheit(decidegC) { function toFahrenheit(decidegC) {
return (decidegC / 10) * 1.8 + 32; return (decidegC / 10) * 1.8 + 32;