Skip to content

Commit 56fdfca

Browse files
committed
Hide 0 axes
1 parent d2cd181 commit 56fdfca

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

packages/base/src/3dview/measurement.ts

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,32 @@ export class Measurement {
5555
const min = this._box.min;
5656
const max = this._box.max;
5757

58-
// Create dimension lines for X, Y, and Z axes
59-
this.createDimensionLine(
60-
new THREE.Vector3(min.x, min.y, min.z),
61-
new THREE.Vector3(max.x, min.y, min.z),
62-
'X',
63-
size.x
64-
);
65-
this.createDimensionLine(
66-
new THREE.Vector3(max.x, min.y, min.z),
67-
new THREE.Vector3(max.x, max.y, min.z),
68-
'Y',
69-
size.y
70-
);
71-
this.createDimensionLine(
72-
new THREE.Vector3(max.x, max.y, min.z),
73-
new THREE.Vector3(max.x, max.y, max.z),
74-
'Z',
75-
size.z
76-
);
58+
// Create dimension lines only for dimensions with a size greater than a small epsilon.
59+
// This is useful for hiding zero-dimension measurements for 2D objects like edges.
60+
if (size.x > 1e-6) {
61+
this.createDimensionLine(
62+
new THREE.Vector3(min.x, min.y, min.z),
63+
new THREE.Vector3(max.x, min.y, min.z),
64+
'X',
65+
size.x
66+
);
67+
}
68+
if (size.y > 1e-6) {
69+
this.createDimensionLine(
70+
new THREE.Vector3(max.x, min.y, min.z),
71+
new THREE.Vector3(max.x, max.y, min.z),
72+
'Y',
73+
size.y
74+
);
75+
}
76+
if (size.z > 1e-6) {
77+
this.createDimensionLine(
78+
new THREE.Vector3(max.x, max.y, min.z),
79+
new THREE.Vector3(max.x, max.y, max.z),
80+
'Z',
81+
size.z
82+
);
83+
}
7784

7885
// The annotations are created for an axis-aligned box at the origin, so transform
7986
// the group to match the object's actual position and orientation (if provided).

0 commit comments

Comments
 (0)