Updated distance in measurement helper so its a settable compoment. See example.js file in measurement helper folder
This commit is contained in:
@@ -5,6 +5,7 @@ class MeasurementBuilder {
|
||||
this.type = null;
|
||||
this.variant = null;
|
||||
this.position = null;
|
||||
this.distance = null;
|
||||
this.windowSize = 10; // Default window size
|
||||
}
|
||||
|
||||
@@ -32,6 +33,11 @@ class MeasurementBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
setDistance(distance) {
|
||||
this.distance = distance;
|
||||
return this;
|
||||
}
|
||||
|
||||
build() {
|
||||
// Validate required fields
|
||||
if (!this.type) {
|
||||
@@ -43,12 +49,14 @@ class MeasurementBuilder {
|
||||
if (!this.position) {
|
||||
throw new Error('Measurement position is required');
|
||||
}
|
||||
// distance is not a requirement as it can be derived from position
|
||||
|
||||
return new Measurement(
|
||||
this.type,
|
||||
this.variant,
|
||||
this.position,
|
||||
this.windowSize
|
||||
this.windowSize,
|
||||
this.distance
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user