Add distance float position handling with backward compatibility #1
@@ -92,7 +92,16 @@ class MeasurementContainer {
|
||||
if (!this._currentVariant) {
|
||||
throw new Error('Variant must be specified before position');
|
||||
}
|
||||
|
||||
// Turn string positions into numeric values
|
||||
if (typeof positionValue == "string") {
|
||||
positionValue = positionValue == "upstream" ? Number.NEGATIVE_INFINITY : positionValue;
|
||||
positionValue = positionValue == "atEquipment" ? 0.0 : positionValue;
|
||||
positionValue = positionValue == "downstream" ? Number.POSITIVE_INFINITY : positionValue;
|
||||
}
|
||||
|
||||
this._currentPosition = positionValue;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user