Fixes an issue where wind speed will always show MPH regardless of units used.
Fixes an issue where pressure will show xxxx.-xxxx when using metric.
Fixes an issue where metric pressures won't fully increment before disappearing.
Fixes an issue where visibility will always show miles regardless of units used.
Full version
Currently, metric rendering in the Current Conditions screens is a bit messy. Assuming a day with visibility greater than 10 miles (16 km) and standard atmospheric pressure (29,92 inHg / 1013 hPa), the second screen of the Current Conditions will show:
VISIBILITY 16 Miles
PRESSURE 1013.-1013
(This assumes that the Pressure display finishes counting that high, as its current starting point of zero does not quite give it enough time to finish tallying, with a suitable gap to be read, before disappearing.)
In addition, there is an issue with the wind in the first screen of the Current Conditions where the wind speed will show "mph" as the unit, regardless of the configuration's setting.
Notes
When a span is hidden from view, it is both hidden and resized to "zero pixels". The work is done twice for a reason: simply hiding the span would leave a giant, hidden-text-sized gap in the middle of things, and simply resizing the span to zero pixels would potentially create an edge case where text that's supposed to be "hidden" could be visible at absurd zoom levels or screen resolutions.
When using metric units, the "count-up" animation starts at 800 hPa (23,62 inHg) to allow there to be enough time for it to finish incrementing and be read before disappearing.
The "mbar" in the pressure display is purely for aesthetic purposes. It feels strange without it, to me, but that could just be me.
I am not proficient in JavaScript, but it's close enough to what I'm used to that I can read it. I didn't see any issues during local testing, but I would absolutely appreciate it if someone who's more proficient at JavaScript than I am could give it another test run.
Complete list of changes made
index.html
GENERAL: All changes listed below are made into their own spans, to allow them to be hidden and resized as necessary.
PRESSURE: Made the decimal point (for imperial measures) its own span.
PRESSURE: Added an mbar flag for use when displaying metric, for aesthetic purposes.
VISIBILITY: Made the "Miles" unit its own span.
VISIBILITY: Added a "km" unit for use when displaying metric.
js/MainScript.js
Added unit flag switching to visibility and air pressure.
Air pressure levels start counting up at 800 if the pressure units are set to hectopascals.
js/WeatherFetching.js
Line 142: Added missing letter "s" onto CONFIG.unit.
Screenshots
Metric mode (units = 'm')
First screen of Current Conditions, set to use metric. The wind speed is stated to be five kilometres per hour.
Second screen of Current Conditions, set to use metric. The visibility is stated to be 16 kilometres, and the air pressure is 1027 millibars.
US mode (units = 'e')
First screen of Current Conditions, set to use US measures. The wind speed is stated to be three miles per hour.
Second screen of the Current Conditions, set to use US measures. The visibility is stated to be 10 miles, and the air pressure is 30.32 inches mercury.
Overview
Cliffnotes version
Full version
Currently, metric rendering in the Current Conditions screens is a bit messy. Assuming a day with visibility greater than 10 miles (16 km) and standard atmospheric pressure (29,92 inHg / 1013 hPa), the second screen of the Current Conditions will show:
(This assumes that the Pressure display finishes counting that high, as its current starting point of zero does not quite give it enough time to finish tallying, with a suitable gap to be read, before disappearing.)
In addition, there is an issue with the wind in the first screen of the Current Conditions where the wind speed will show "mph" as the unit, regardless of the configuration's setting.
Notes
Complete list of changes made
mbar
flag for use when displaying metric, for aesthetic purposes.CONFIG.unit
.Screenshots
Metric mode (
units = 'm'
)US mode (
units = 'e'
)