@xeokit/xeokit-sdk 2.6.91 → 2.6.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xeokit-sdk.cjs.js +58 -12
- package/dist/xeokit-sdk.es.js +58 -12
- package/dist/xeokit-sdk.es5.js +22 -8
- package/dist/xeokit-sdk.min.cjs.js +8 -8
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +5 -5
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +21 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +32 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.92",
|
|
4
4
|
"description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
|
|
5
5
|
"module": "./dist/xeokit-sdk.es.js",
|
|
6
6
|
"main": "./dist/xeokit-sdk.cjs.js",
|
|
@@ -60,6 +60,9 @@ class AngleMeasurement extends Component {
|
|
|
60
60
|
|
|
61
61
|
this.approximate = cfg.approximate;
|
|
62
62
|
|
|
63
|
+
this._labelStringFormat = (angle) => {
|
|
64
|
+
return (this._approximate ? " ~ " : " = ") + angle.toFixed(2) + "°";
|
|
65
|
+
};
|
|
63
66
|
|
|
64
67
|
const canvas = scene.canvas.canvas;
|
|
65
68
|
|
|
@@ -181,7 +184,7 @@ class AngleMeasurement extends Component {
|
|
|
181
184
|
math.normalizeVec3(tmpVec3a);
|
|
182
185
|
math.normalizeVec3(tmpVec3b);
|
|
183
186
|
this._angle = Math.abs(math.angleVec3(tmpVec3a, tmpVec3b)) * math.RADTODEG;
|
|
184
|
-
this._angleLabel.setText(
|
|
187
|
+
this._angleLabel.setText(this._labelStringFormat(this._angle));
|
|
185
188
|
} else {
|
|
186
189
|
this._angle = undefined;
|
|
187
190
|
this._angleLabel.setText("");
|
|
@@ -441,6 +444,23 @@ class AngleMeasurement extends Component {
|
|
|
441
444
|
this._drawables.forEach(d => d.setClickable(this._clickable.get()));
|
|
442
445
|
}
|
|
443
446
|
|
|
447
|
+
/**
|
|
448
|
+
* Gets the function that formats the angle label's text.
|
|
449
|
+
*
|
|
450
|
+
* By default, this function formats the angle with two decimal places.
|
|
451
|
+
*/
|
|
452
|
+
get labelStringFormat() {
|
|
453
|
+
return this._labelStringFormat;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Sets the function that formats the angle label's text.
|
|
458
|
+
*/
|
|
459
|
+
set labelStringFormat(value) {
|
|
460
|
+
this._labelStringFormat = value;
|
|
461
|
+
this._update();
|
|
462
|
+
}
|
|
463
|
+
|
|
444
464
|
/**
|
|
445
465
|
* Gets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
|
|
446
466
|
*
|
|
@@ -72,6 +72,13 @@ class DistanceMeasurement extends Component {
|
|
|
72
72
|
this._axesBasis = math.identityMat4();
|
|
73
73
|
this.approximate = cfg.approximate;
|
|
74
74
|
|
|
75
|
+
this._labelStringFormat = (len) => {
|
|
76
|
+
const metrics = this.plugin.viewer.scene.metrics;
|
|
77
|
+
const scale = metrics.scale;
|
|
78
|
+
const unit = metrics.unitsInfo[metrics.units].abbrev;
|
|
79
|
+
|
|
80
|
+
return (this.approximate ? " ~ " : " = ") + (len * scale).toFixed(2) + unit;
|
|
81
|
+
};
|
|
75
82
|
|
|
76
83
|
const canvas = scene.canvas.canvas;
|
|
77
84
|
|
|
@@ -209,24 +216,24 @@ class DistanceMeasurement extends Component {
|
|
|
209
216
|
label.setPosOnWire(p0, p1, offsetIdx * 35, 0);
|
|
210
217
|
}
|
|
211
218
|
};
|
|
212
|
-
const unitStr = len => (this._approximate ? " ~ " : " = ") + len.toFixed(2) + unit;
|
|
213
219
|
|
|
214
220
|
this._xAxisWire.setEnds(p0, xEnd);
|
|
215
221
|
setAxisLabelCoords(this._xAxisLabel, p0, xEnd, 1);
|
|
216
|
-
this._xAxisLabel.setText("X" +
|
|
222
|
+
this._xAxisLabel.setText("X" + this._labelStringFormat(math.distVec3(p0, xEnd)));
|
|
217
223
|
|
|
218
224
|
this._yAxisWire.setEnds(xEnd, zStart);
|
|
219
225
|
setAxisLabelCoords(this._yAxisLabel, xEnd, zStart, 2);
|
|
220
|
-
this._yAxisLabel.setText("Y" +
|
|
226
|
+
this._yAxisLabel.setText("Y" + this._labelStringFormat(math.distVec3(xEnd, zStart)));
|
|
221
227
|
|
|
222
228
|
this._zAxisWire.setEnds(zStart, p1);
|
|
223
229
|
setAxisLabelCoords(this._zAxisLabel, zStart, p1, 3);
|
|
224
|
-
this._zAxisLabel.setText((measurementOrientationVertical ? "" : "Z") +
|
|
230
|
+
this._zAxisLabel.setText((measurementOrientationVertical ? "" : "Z") + this._labelStringFormat(math.distVec3(zStart, p1)));
|
|
225
231
|
|
|
226
232
|
this._lengthWire.setEnds(p0, p1);
|
|
227
233
|
setAxisLabelCoords(this._lengthLabel, p0, p1, 0);
|
|
228
|
-
|
|
229
|
-
this.
|
|
234
|
+
const length = math.distVec3(p0, p1);
|
|
235
|
+
this._length = length * scale;
|
|
236
|
+
this._lengthLabel.setText(this._labelStringFormat(length));
|
|
230
237
|
};
|
|
231
238
|
|
|
232
239
|
if (measurementOrientationVertical) {
|
|
@@ -679,6 +686,25 @@ class DistanceMeasurement extends Component {
|
|
|
679
686
|
return this._clickable.get();
|
|
680
687
|
}
|
|
681
688
|
|
|
689
|
+
/**
|
|
690
|
+
* Sets the function to format unit strings.
|
|
691
|
+
*
|
|
692
|
+
* @type {Function}
|
|
693
|
+
*/
|
|
694
|
+
set labelStringFormat(value) {
|
|
695
|
+
this._labelStringFormat = value;
|
|
696
|
+
this._update();
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Gets the function to format unit strings.
|
|
701
|
+
*
|
|
702
|
+
* @type {Function}
|
|
703
|
+
*/
|
|
704
|
+
get labelStringFormat() {
|
|
705
|
+
return this._labelStringFormat;
|
|
706
|
+
}
|
|
707
|
+
|
|
682
708
|
/**
|
|
683
709
|
* @private
|
|
684
710
|
*/
|