@xeokit/xeokit-sdk 2.6.31 → 2.6.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.31",
3
+ "version": "2.6.33",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -65,20 +65,23 @@ export class PointerLens {
65
65
  this._lensCursorDiv.style.pointerEvents = "none";
66
66
 
67
67
  this._lensContainer = document.createElement('div');
68
+ this._lensContainerId = cfg.containerId || 'xeokit-lens';
69
+ this._lensContainer.setAttribute("id", this._lensContainerId);
70
+
68
71
  this._lensContainer.style.border = "1px solid black";
69
72
  this._lensContainer.style.background = "white";
70
73
  // this._lensContainer.style.opacity = "0";
71
74
  this._lensContainer.style.borderRadius = "50%";
72
75
  this._lensContainer.style.width = "300px";
73
76
  this._lensContainer.style.height = "300px";
74
- this._lensContainer.style.marginTop = "85px";
75
- this._lensContainer.style.marginLeft = "25px";
77
+
76
78
  this._lensContainer.style.zIndex = "15000";
77
79
  this._lensContainer.style.position = "absolute";
78
80
  this._lensContainer.style.pointerEvents = "none";
79
81
  this._lensContainer.style.visibility = "hidden";
80
82
 
81
83
  this._lensCanvas = document.createElement('canvas');
84
+ this._lensCanvas.id = `${this._lensContainerId}-canvas`;
82
85
  // this._lensCanvas.style.background = "darkblue";
83
86
  this._lensCanvas.style.borderRadius = "50%";
84
87
 
@@ -95,7 +98,12 @@ export class PointerLens {
95
98
 
96
99
  this._canvasPos = null;
97
100
  this._snappedCanvasPos = null;
98
- this._lensPosToggle = true;
101
+ this._lensPosToggle = cfg.lensPosToggle || true;
102
+ this._lensPosToggleAmount = cfg.lensPosToggleAmount || 85;
103
+ this._lensPosMarginLeft = cfg.lensPosMarginLeft || 85;
104
+ this._lensPosMarginTop = cfg.lensPosMarginTop || 25;
105
+ this._lensContainer.style.marginTop = `${this._lensPosMarginTop}px`;
106
+ this._lensContainer.style.marginLeft = `${this._lensPosMarginLeft}px`;
99
107
 
100
108
  this._zoomLevel = cfg.zoomLevel || 2;
101
109
 
@@ -125,12 +133,12 @@ export class PointerLens {
125
133
  const pointerOnLens =
126
134
  this._canvasPos[0] < lensRect.right && this._canvasPos[0] > lensRect.left &&
127
135
  this._canvasPos[1] < lensRect.bottom && this._canvasPos[1] > lensRect.top;
128
- this._lensContainer.style.marginLeft = `25px`;
136
+ this._lensContainer.style.marginLeft = `${this._lensPosMarginLeft}px`;
129
137
  if (pointerOnLens) {
130
138
  if (this._lensPosToggle) {
131
- this._lensContainer.style.marginTop = `${canvasRect.bottom - canvasRect.top - this._lensCanvas.height - 85}px`;
139
+ this._lensContainer.style.marginTop = `${canvasRect.bottom - canvasRect.top - this._lensCanvas.height - this._lensPosToggleAmount}px`;
132
140
  } else {
133
- this._lensContainer.style.marginTop = `85px`;
141
+ this._lensContainer.style.marginTop = `${this._lensPosMarginTop}px`;
134
142
  }
135
143
  this._lensPosToggle = !this._lensPosToggle;
136
144
  }
@@ -6,6 +6,7 @@ import {Component} from "../../viewer/scene/Component.js";
6
6
 
7
7
 
8
8
  const distVec3 = math.vec3();
9
+ const tmpVec3 = math.vec3();
9
10
 
10
11
  const lengthWire = (x1, y1, x2, y2) => {
11
12
  var a = x1 - x2;
@@ -316,6 +317,44 @@ class DistanceMeasurement extends Component {
316
317
  this.labelsVisible = cfg.labelsVisible;
317
318
  this.labelsOnWires = cfg.labelsOnWires;
318
319
  this.useRotationAdjustment = cfg.useRotationAdjustment;
320
+
321
+ /**
322
+ * @type {number[]}
323
+ */
324
+ this._axesBasis = [
325
+ 1, 0, 0, 0,
326
+ 0, 1, 0, 0,
327
+ 0, 0, 1, 0,
328
+ 0, 0, 0, 1,
329
+ ];
330
+ }
331
+
332
+ /**
333
+ * Sets the axes basis for the measurement.
334
+ *
335
+ * The value is a 4x4 matrix where each column-vector defines an axis and must have unit length.
336
+ *
337
+ * This is the ```identity``` matrix by default, meaning the measurement axes are the same as the world axes.
338
+ *
339
+ * @param {number[]} value
340
+ */
341
+ set axesBasis(value) {
342
+ this._axesBasis = value.slice();
343
+ this._wpDirty = true;
344
+ this._needUpdate(0); // No lag
345
+ }
346
+
347
+ /**
348
+ * Gets the axes basis for the measurement.
349
+ *
350
+ * The value is a 4x4 matrix where each column-vector defines an axis and must have unit length.
351
+ *
352
+ * This is the ```identity``` matrix by default, meaning the measurement axes are the same as the world axes.
353
+ *
354
+ * @type {number[]}
355
+ */
356
+ get axesBasis() {
357
+ return this._axesBasis;
319
358
  }
320
359
 
321
360
  _update() {
@@ -351,19 +390,30 @@ class DistanceMeasurement extends Component {
351
390
  this._wp[15] = 1.0;
352
391
  }
353
392
  else {
393
+ const delta = math.subVec3(
394
+ this._targetWorld,
395
+ this._originWorld,
396
+ tmpVec3
397
+ );
398
+
399
+ /**
400
+ * The length detected for each measurement axis.
401
+ */
402
+ this._factors = math.transformVec3(this._axesBasis, delta);
403
+
354
404
  this._wp[0] = this._originWorld[0];
355
405
  this._wp[1] = this._originWorld[1];
356
406
  this._wp[2] = this._originWorld[2];
357
407
  this._wp[3] = 1.0;
358
408
 
359
- this._wp[4] = this._targetWorld[0];
360
- this._wp[5] = this._originWorld[1];
361
- this._wp[6] = this._originWorld[2];
409
+ this._wp[4] = this._originWorld[0] + this._axesBasis[0]*this._factors[0];
410
+ this._wp[5] = this._originWorld[1] + this._axesBasis[4]*this._factors[0];
411
+ this._wp[6] = this._originWorld[2] + this._axesBasis[8]*this._factors[0];
362
412
  this._wp[7] = 1.0;
363
413
 
364
- this._wp[8] = this._targetWorld[0];
365
- this._wp[9] = this._targetWorld[1];
366
- this._wp[10] = this._originWorld[2];
414
+ this._wp[8] = this._originWorld[0] + this._axesBasis[0]*this._factors[0]+ this._axesBasis[1]*this._factors[1];
415
+ this._wp[9] = this._originWorld[1] + this._axesBasis[4]*this._factors[0]+ this._axesBasis[5]*this._factors[1];
416
+ this._wp[10] = this._originWorld[2] + this._axesBasis[8]*this._factors[0]+ this._axesBasis[9]*this._factors[1];;
367
417
  this._wp[11] = 1.0;
368
418
 
369
419
  this._wp[12] = this._targetWorld[0];
@@ -525,14 +575,14 @@ class DistanceMeasurement extends Component {
525
575
  }
526
576
 
527
577
  if (!this._xAxisLabelCulled) {
528
- this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
578
+ this._xAxisLabel.setText(tilde + Math.abs(this._factors[0] * scale).toFixed(2) + unitAbbrev);
529
579
  this._xAxisLabel.setCulled(!this.axisVisible);
530
580
  } else {
531
581
  this._xAxisLabel.setCulled(true);
532
582
  }
533
583
 
534
584
  if (!this._yAxisLabelCulled) {
535
- this._yAxisLabel.setText(tilde + Math.abs((this._targetWorld[1] - this._originWorld[1]) * scale).toFixed(2) + unitAbbrev);
585
+ this._yAxisLabel.setText(tilde + Math.abs(this._factors[1] * scale).toFixed(2) + unitAbbrev);
536
586
  this._yAxisLabel.setCulled(!this.axisVisible);
537
587
  } else {
538
588
  this._yAxisLabel.setCulled(true);
@@ -545,7 +595,7 @@ class DistanceMeasurement extends Component {
545
595
  }
546
596
  else {
547
597
  this._zAxisLabel.setPrefix("Z");
548
- this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
598
+ this._zAxisLabel.setText(tilde + Math.abs(this._factors[2] * scale).toFixed(2) + unitAbbrev);
549
599
  }
550
600
  this._zAxisLabel.setCulled(!this.axisVisible);
551
601
  } else {
@@ -880,6 +880,9 @@ class XKTLoaderPlugin extends Plugin {
880
880
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
881
881
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
882
882
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
883
+ * @param {Number} [params.renderOrder=0] Specifies the rendering order for the model. This is used to control the order in which
884
+ * SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
885
+ * render pass.
883
886
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
884
887
  */
885
888
  load(params = {}) {
@@ -929,7 +932,8 @@ class XKTLoaderPlugin extends Plugin {
929
932
  origin: params.origin,
930
933
  disableVertexWelding: params.disableVertexWelding || false,
931
934
  disableIndexRebucketing: params.disableIndexRebucketing || false,
932
- dtxEnabled: params.dtxEnabled
935
+ dtxEnabled: params.dtxEnabled,
936
+ renderOrder: params.renderOrder
933
937
  }));
934
938
 
935
939
  const modelId = sceneModel.id; // In case ID was auto-generated
@@ -271,10 +271,9 @@ const basePolygon3D = function(scene, color, alpha) {
271
271
  };
272
272
  };
273
273
 
274
- const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, pointerLens, zonesPlugin, select3dPoint, onZoneCreated) {
275
- const marker1 = marker3D(scene, zoneColor);
276
- const marker2 = marker3D(scene, zoneColor);
277
- const basePolygon = basePolygon3D(scene, zoneColor, zoneAlpha);
274
+ const startAARectCreateUI = function(scene, markersColor, pointerLens, select3dPoint, withPoints, onPointsSelected) {
275
+ const marker1 = marker3D(scene, markersColor);
276
+ const marker2 = marker3D(scene, markersColor);
278
277
 
279
278
  const updatePointerLens = (pointerLens
280
279
  ? function(canvasPos) {
@@ -302,29 +301,14 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
302
301
  function() {
303
302
  updatePointerLens(null);
304
303
  marker2.update(null);
305
- basePolygon.updateBase(null);
304
+ withPoints(null);
306
305
  },
307
306
  function(canvasPos, point2WorldPos) {
308
307
  updatePointerLens(canvasPos);
309
308
  marker2.update(point2WorldPos);
310
-
311
- if (math.distVec3(point1WorldPos, point2WorldPos) > 0.01)
312
- {
313
- const min = (idx) => Math.min(point1WorldPos[idx], point2WorldPos[idx]);
314
- const max = (idx) => Math.max(point1WorldPos[idx], point2WorldPos[idx]);
315
-
316
- const xmin = min(0);
317
- const ymin = min(1);
318
- const zmin = min(2);
319
- const xmax = max(0);
320
- const ymax = max(1);
321
- const zmax = max(2);
322
-
323
- basePolygon.updateBase([ [ xmin, ymin, zmax ], [ xmax, ymin, zmax ],
324
- [ xmax, ymin, zmin ], [ xmin, ymin, zmin ] ]);
325
- }
326
- else
327
- basePolygon.updateBase(null);
309
+ withPoints((math.distVec3(point1WorldPos, point2WorldPos) > 0.01)
310
+ &&
311
+ [ point1WorldPos, point2WorldPos ]);
328
312
  },
329
313
  function(point2CanvasPos, point2WorldPos) {
330
314
  // `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
@@ -334,35 +318,9 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
334
318
 
335
319
  marker1.destroy();
336
320
  marker2.destroy();
337
- basePolygon.destroy();
338
321
  updatePointerLens(null);
339
322
 
340
- const min = (idx) => Math.min(point1WorldPos[idx], point2WorldPos[idx]);
341
- const max = (idx) => Math.max(point1WorldPos[idx], point2WorldPos[idx]);
342
-
343
- const xmin = min(0);
344
- const zmin = min(2);
345
- const xmax = max(0);
346
- const zmax = max(2);
347
-
348
- const zone = zonesPlugin.createZone(
349
- {
350
- id: math.createUUID(),
351
- geometry: {
352
- planeCoordinates: [
353
- [ xmin, zmax ],
354
- [ xmax, zmax ],
355
- [ xmax, zmin ],
356
- [ xmin, zmin ]
357
- ],
358
- altitude: zoneAltitude,
359
- height: zoneHeight
360
- },
361
- alpha: zoneAlpha,
362
- color: zoneColor
363
- });
364
-
365
- onZoneCreated(zone);
323
+ onPointsSelected([ point1WorldPos, point2WorldPos ]);
366
324
  });
367
325
  });
368
326
 
@@ -371,7 +329,6 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
371
329
  deactivatePointSelection();
372
330
  marker1.destroy();
373
331
  marker2.destroy();
374
- basePolygon.destroy();
375
332
  updatePointerLens(null);
376
333
  }
377
334
  };
@@ -1052,6 +1009,34 @@ class Zone extends Component {
1052
1009
  }
1053
1010
  }
1054
1011
 
1012
+ const createAAZoneFromPoints = function(pos1, pos2, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, zonesPlugin) {
1013
+
1014
+ const min = (idx) => Math.min(pos1[idx], pos2[idx]);
1015
+ const max = (idx) => Math.max(pos1[idx], pos2[idx]);
1016
+
1017
+ const xmin = min(0);
1018
+ const zmin = min(2);
1019
+ const xmax = max(0);
1020
+ const zmax = max(2);
1021
+
1022
+ return zonesPlugin.createZone(
1023
+ {
1024
+ id: math.createUUID(),
1025
+ geometry: {
1026
+ planeCoordinates: [
1027
+ [ xmin, zmax ],
1028
+ [ xmax, zmax ],
1029
+ [ xmax, zmin ],
1030
+ [ xmin, zmin ]
1031
+ ],
1032
+ altitude: zoneAltitude,
1033
+ height: zoneHeight
1034
+ },
1035
+ alpha: zoneAlpha,
1036
+ color: zoneColor
1037
+ });
1038
+ };
1039
+
1055
1040
  /**
1056
1041
  * Creates {@link Zone}s in a {@link ZonesPlugin} from mouse input.
1057
1042
  *
@@ -1082,7 +1067,7 @@ class Zone extends Component {
1082
1067
  * const zonesControl = new ZonesMouseControl(Zones)
1083
1068
  * ````
1084
1069
  */
1085
- class ZonesMouseControl extends Component {
1070
+ class ZonesAAZoneControl extends Component {
1086
1071
 
1087
1072
  /**
1088
1073
  * Creates a ZonesMouseControl bound to the given ZonesPlugin.
@@ -1091,11 +1076,12 @@ class ZonesMouseControl extends Component {
1091
1076
  * @param [cfg] Configuration
1092
1077
  * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
1093
1078
  */
1094
- constructor(zonesPlugin, cfg = {}) {
1079
+ constructor(zonesPlugin, cfg, createSelect3dPoint) {
1095
1080
  super(zonesPlugin.viewer.scene);
1096
1081
 
1097
1082
  this.zonesPlugin = zonesPlugin;
1098
1083
  this.pointerLens = cfg.pointerLens;
1084
+ this.createSelect3dPoint = createSelect3dPoint;
1099
1085
  this._deactivate = null;
1100
1086
  }
1101
1087
 
@@ -1132,16 +1118,35 @@ class ZonesMouseControl extends Component {
1132
1118
  const scene = viewer.scene;
1133
1119
  const self = this;
1134
1120
 
1135
- const select3dPoint = mousePointSelector(
1136
- viewer,
1137
- function(origin, direction) {
1138
- return planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction);
1139
- });
1121
+ const select3dPoint = this.createSelect3dPoint(viewer, (origin, direction) => planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction));
1140
1122
 
1141
1123
  (function rec() {
1142
- self._deactivate = startAAZoneCreateUI(
1143
- scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, self.pointerLens, zonesPlugin, select3dPoint,
1144
- zone => {
1124
+ const basePolygon = basePolygon3D(scene, zoneColor, zoneAlpha);
1125
+ const deactivate = startAARectCreateUI(
1126
+ scene, zoneColor, self.pointerLens, select3dPoint,
1127
+ points => {
1128
+ if (points) {
1129
+ const p0 = points[0];
1130
+ const p1 = points[1];
1131
+ const min = (idx) => Math.min(p0[idx], p1[idx]);
1132
+ const max = (idx) => Math.max(p0[idx], p1[idx]);
1133
+
1134
+ const xmin = min(0);
1135
+ const ymin = min(1);
1136
+ const zmin = min(2);
1137
+ const xmax = max(0);
1138
+ const ymax = max(1);
1139
+ const zmax = max(2);
1140
+
1141
+ basePolygon.updateBase([ [ xmin, ymin, zmax ], [ xmax, ymin, zmax ],
1142
+ [ xmax, ymin, zmin ], [ xmin, ymin, zmin ] ]);
1143
+ } else {
1144
+ basePolygon.updateBase(null);
1145
+ }
1146
+ },
1147
+ points => {
1148
+ basePolygon.destroy();
1149
+ const zone = createAAZoneFromPoints(points[0], points[1], zoneAltitude, zoneHeight, zoneColor, zoneAlpha, zonesPlugin);
1145
1150
  let reactivate = true;
1146
1151
  self._deactivate = () => { reactivate = false; };
1147
1152
  self.fire("zoneEnd", zone);
@@ -1150,6 +1155,10 @@ class ZonesMouseControl extends Component {
1150
1155
  rec();
1151
1156
  }
1152
1157
  }).deactivate;
1158
+ self._deactivate = () => {
1159
+ deactivate();
1160
+ basePolygon.destroy();
1161
+ };
1153
1162
  })();
1154
1163
  }
1155
1164
 
@@ -1172,10 +1181,36 @@ class ZonesMouseControl extends Component {
1172
1181
  }
1173
1182
  }
1174
1183
 
1184
+ export class ZonesMouseControl extends ZonesAAZoneControl {
1185
+ constructor(zonesPlugin, cfg = {}) {
1186
+ super(
1187
+ zonesPlugin,
1188
+ cfg,
1189
+ (viewer, ray2WorldPos) => mousePointSelector(viewer, ray2WorldPos));
1190
+ }
1191
+ }
1192
+
1193
+ import {PointerCircle} from "../../extras/PointerCircle/PointerCircle.js";
1194
+ export class ZonesTouchControl extends ZonesAAZoneControl {
1195
+ constructor(zonesPlugin, cfg = {}) {
1196
+ const pointerCircle = new PointerCircle(zonesPlugin.viewer);
1197
+ super(
1198
+ zonesPlugin,
1199
+ cfg,
1200
+ (viewer, ray2WorldPos) => touchPointSelector(viewer, pointerCircle, ray2WorldPos));
1201
+ this.pointerCircle = pointerCircle;
1202
+ }
1203
+
1204
+ destroy() {
1205
+ this.pointerCircle.destroy();
1206
+ super.destroy();
1207
+ }
1208
+ }
1209
+
1175
1210
  /**
1176
1211
  * ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.
1177
1212
  */
1178
- class ZonesPlugin extends Plugin {
1213
+ export class ZonesPlugin extends Plugin {
1179
1214
 
1180
1215
  /**
1181
1216
  * @constructor
@@ -1286,88 +1321,6 @@ class ZonesPlugin extends Plugin {
1286
1321
  }
1287
1322
  }
1288
1323
 
1289
- import {PointerCircle} from "../../extras/PointerCircle/PointerCircle.js";
1290
-
1291
- export class ZonesTouchControl extends Component {
1292
-
1293
- constructor(zonesPlugin, cfg = {}) {
1294
- super(zonesPlugin.viewer.scene);
1295
-
1296
- this.zonesPlugin = zonesPlugin;
1297
- this.pointerLens = cfg.pointerLens;
1298
- this.pointerCircle = new PointerCircle(zonesPlugin.viewer);
1299
- this._deactivate = null;
1300
- }
1301
-
1302
- get active() {
1303
- return !! this._deactivate;
1304
- }
1305
-
1306
- activate(zoneAltitude, zoneHeight, zoneColor, zoneAlpha) {
1307
-
1308
- if (typeof(zoneAltitude) === "object" && (zoneAltitude !== null)) {
1309
- const params = zoneAltitude;
1310
- const param = (name, defaultValue) => {
1311
- if (name in params) {
1312
- return params[name];
1313
- } else if (defaultValue !== undefined) {
1314
- return defaultValue;
1315
- } else {
1316
- throw "config missing: " + name;
1317
- }
1318
- };
1319
-
1320
- zoneAltitude = param("altitude");
1321
- zoneHeight = param("height");
1322
- zoneColor = param("color", "#008000");
1323
- zoneAlpha = param("alpha", 0.5);
1324
- }
1325
-
1326
- if (this._deactivate) {
1327
- return;
1328
- }
1329
-
1330
- const zonesPlugin = this.zonesPlugin;
1331
- const viewer = zonesPlugin.viewer;
1332
- const scene = viewer.scene;
1333
- const self = this;
1334
-
1335
- const select3dPoint = touchPointSelector(
1336
- viewer,
1337
- this.pointerCircle,
1338
- function(origin, direction) {
1339
- return planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction);
1340
- });
1341
-
1342
- (function rec() {
1343
- self._deactivate = startAAZoneCreateUI(
1344
- scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, self.pointerLens, zonesPlugin, select3dPoint,
1345
- zone => {
1346
- let reactivate = true;
1347
- self._deactivate = () => { reactivate = false; };
1348
- self.fire("zoneEnd", zone);
1349
- if (reactivate)
1350
- {
1351
- rec();
1352
- }
1353
- }).deactivate;
1354
- })();
1355
- }
1356
-
1357
- deactivate() {
1358
- if (this._deactivate)
1359
- {
1360
- this._deactivate();
1361
- this._deactivate = null;
1362
- }
1363
- }
1364
-
1365
- destroy() {
1366
- this.deactivate();
1367
- super.destroy();
1368
- }
1369
- }
1370
-
1371
1324
  const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, pointerLens, zonesPlugin, select3dPoint, onZoneCreated) {
1372
1325
  const updatePointerLens = (pointerLens
1373
1326
  ? function(canvasPos) {
@@ -1933,7 +1886,3 @@ export class ZoneTranslateTouchControl extends ZoneTranslateControl {
1933
1886
  super(zone, cfg, false, true);
1934
1887
  }
1935
1888
  }
1936
-
1937
-
1938
- export {ZonesMouseControl}
1939
- export {ZonesPlugin}
@@ -15,7 +15,7 @@ class Dot {
15
15
  this._dotClickable = document.createElement('div');
16
16
  this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';
17
17
 
18
- this._visible = !!cfg.visible;
18
+ this._visible = cfg.visible !== false;
19
19
  this._culled = false;
20
20
 
21
21
  var dot = this._dot;
@@ -27,7 +27,7 @@ class Dot {
27
27
  dotStyle["z-index"] = cfg.zIndex === undefined ? "40000005" : cfg.zIndex ;
28
28
  dotStyle.width = 8 + "px";
29
29
  dotStyle.height = 8 + "px";
30
- dotStyle.visibility = cfg.visible !== false ? "visible" : "hidden";
30
+ dotStyle.visibility = this._visible ? "visible" : "hidden";
31
31
  dotStyle.top = 0 + "px";
32
32
  dotStyle.left = 0 + "px";
33
33
  dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
@@ -91,7 +91,7 @@ export class MeshVolume {
91
91
  volume += math.dotVec3(v1, v3);
92
92
  }
93
93
 
94
- return volume;
94
+ return volume / 6;
95
95
  }
96
96
  }
97
97
 
@@ -244,7 +244,9 @@ class VBOInstancingLinesLayer {
244
244
  this._modelMatrixCol1 = [];
245
245
  this._modelMatrixCol2 = [];
246
246
  }
247
- this._state.geometry = null;
247
+ if (!this.model.scene.readableGeometryEnabled) {
248
+ this._state.geometry = null;
249
+ }
248
250
  this._finalized = true;
249
251
  }
250
252
 
@@ -36,7 +36,7 @@ export class VBOInstancingTrianglesLayer {
36
36
  */
37
37
  constructor(cfg) {
38
38
 
39
- // console.info("Creating VBOInstancingTrianglesLayer");
39
+ // console.info("Creating VBOInstancingTrianglesLayer");
40
40
 
41
41
  /**
42
42
  * Owner model
@@ -378,7 +378,9 @@ export class VBOInstancingTrianglesLayer {
378
378
  && !!textureSet
379
379
  && !!textureSet.colorTexture;
380
380
 
381
- this._state.geometry = null;
381
+ if (!this.model.scene.readableGeometryEnabled) {
382
+ this._state.geometry = null;
383
+ }
382
384
 
383
385
  this._finalized = true;
384
386
  }
@@ -705,11 +707,11 @@ export class VBOInstancingTrianglesLayer {
705
707
  this.model.error("portion not found: " + portionId);
706
708
  return;
707
709
  }
708
- const positions = geometry.quantizedPositions;
710
+ const positions = geometry.positionsCompressed;
709
711
  const origin = state.origin;
710
- const offsetX = origin[0] ;
711
- const offsetY = origin[1] ;
712
- const offsetZ = origin[2] ;
712
+ const offsetX = origin[0];
713
+ const offsetY = origin[1];
714
+ const offsetZ = origin[2];
713
715
  const worldPos = tempVec4a;
714
716
  const portionMatrix = portion.matrix;
715
717
  const sceneModelMatrix = this.model.matrix;
@@ -785,7 +787,7 @@ export class VBOInstancingTrianglesLayer {
785
787
  return;
786
788
  }
787
789
  this._updateBackfaceCull(renderFlags, frameCtx);
788
- const useAlphaCutoff = this._state.textureSet && (typeof(this._state.textureSet.alphaCutoff) === "number");
790
+ const useAlphaCutoff = this._state.textureSet && (typeof (this._state.textureSet.alphaCutoff) === "number");
789
791
  if (frameCtx.withSAO && this.model.saoEnabled) {
790
792
  if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {
791
793
  if (this._renderers.pbrRendererWithSAO) {