Add distance float position handling with backward compatibility #1

Merged
p.vanderwilt merged 22 commits from :main into main 2025-09-26 11:41:53 +00:00
Showing only changes of commit 16e202e841 - Show all commits

View File

@@ -88,11 +88,11 @@ class MeasurementContainer {
return this; return this;
} }
position(positionName) { position(positionValue) {
if (!this._currentVariant) { if (!this._currentVariant) {
throw new Error('Variant must be specified before position'); throw new Error('Variant must be specified before position');
} }
this._currentPosition = positionName; this._currentPosition = positionValue;
return this; return this;
} }
@@ -243,10 +243,12 @@ class MeasurementContainer {
const savedPosition = this._currentPosition; const savedPosition = this._currentPosition;
// Get upstream and downstream measurements // Get upstream and downstream measurements
this._currentPosition = 'upstream'; const positions = this.getPositions();
this._currentPosition = Math.min(...positions);
const upstream = this.get(); const upstream = this.get();
this._currentPosition = 'downstream'; this._currentPosition = Math.max(...positions);
const downstream = this.get(); const downstream = this.get();
this._currentPosition = savedPosition; this._currentPosition = savedPosition;