Skip to content

Commit 10dc38d

Browse files
Merge pull request #225 from mikhailmtion/feature/add-units
Add feature change units in dimension Thank you @mikhailmtion 🙂
2 parents 72579c0 + fdba60a commit 10dc38d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

viewer/src/components/display/dimensions/dimension-line.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class IfcDimensionLine {
215215
}
216216

217217
private getTextContent() {
218-
return `${this.length / IfcDimensionLine.scale} ${IfcDimensionLine.units}`;
218+
return `${this.length * IfcDimensionLine.scale} ${IfcDimensionLine.units}`;
219219
}
220220

221221
private newBoundingBox() {

viewer/src/components/display/dimensions/dimensions.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ export class IfcDimensions extends IfcComponent {
197197
this.currentDimension = undefined;
198198
}
199199

200+
setDimensionUnit(units: string) {
201+
if (!units) return;
202+
if (units === "mm") {
203+
IfcDimensionLine.units = units;
204+
IfcDimensionLine.scale = 1000;
205+
} else if (units === "m") {
206+
IfcDimensionLine.units = units;
207+
IfcDimensionLine.scale = 1;
208+
}
209+
}
210+
200211
private drawStart() {
201212
this.dragging = true;
202213
const intersects = this.context.castRayIfc();

0 commit comments

Comments
 (0)