mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Ignore invalid units in field input
This commit is contained in:
@@ -101,7 +101,12 @@ export function uiFieldRoadheight(field, context) {
|
||||
|
||||
|
||||
function changeUnits() {
|
||||
_isImperial = utilGetSetValue(primaryUnitInput) === 'ft';
|
||||
var primaryUnit = utilGetSetValue(primaryUnitInput);
|
||||
if (primaryUnit === 'm') {
|
||||
_isImperial = false;
|
||||
} else if (primaryUnit === 'ft') {
|
||||
_isImperial = true;
|
||||
}
|
||||
utilGetSetValue(primaryUnitInput, _isImperial ? 'ft' : 'm');
|
||||
setUnitSuggestions();
|
||||
change();
|
||||
|
||||
@@ -70,7 +70,12 @@ export function uiFieldRoadspeed(field, context) {
|
||||
|
||||
|
||||
function changeUnits() {
|
||||
_isImperial = utilGetSetValue(unitInput) === 'mph';
|
||||
var unit = utilGetSetValue(unitInput);
|
||||
if (unit === 'km/h') {
|
||||
_isImperial = false;
|
||||
} else if (unit === 'mph') {
|
||||
_isImperial = true;
|
||||
}
|
||||
utilGetSetValue(unitInput, _isImperial ? 'mph' : 'km/h');
|
||||
setUnitSuggestions();
|
||||
change();
|
||||
|
||||
Reference in New Issue
Block a user