zincjs 3.0.0 → 3.0.1

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.
Files changed (60) hide show
  1. package/README.md +27 -22
  2. package/build/zinc.js +2 -2
  3. package/build/zinc.js.map +1 -1
  4. package/package.json +4 -1
  5. package/src/controls.js +1332 -1241
  6. package/src/geometryCSG.js +111 -115
  7. package/src/glyphsetCSG.js +51 -55
  8. package/src/loaders/GLTFToZincJSLoader.js +31 -33
  9. package/src/loaders/JSONLoader.js +339 -449
  10. package/src/loaders/OBJLoader.js +654 -851
  11. package/src/loaders/STLLoader.js +271 -329
  12. package/src/loaders/niftiReader.js +90 -59
  13. package/src/loaders/primitivesLoader.js +55 -52
  14. package/src/minimap.js +63 -43
  15. package/src/primitives/geometry.js +40 -44
  16. package/src/primitives/glyph.js +16 -19
  17. package/src/primitives/glyphset.js +229 -185
  18. package/src/primitives/label.js +29 -31
  19. package/src/primitives/lines.js +20 -20
  20. package/src/primitives/lines2.js +33 -39
  21. package/src/primitives/lod.js +43 -43
  22. package/src/primitives/marker.js +31 -32
  23. package/src/primitives/markerCluster.js +32 -35
  24. package/src/primitives/pointset.js +86 -83
  25. package/src/primitives/texturePrimitive.js +9 -10
  26. package/src/primitives/textureSlides.js +84 -97
  27. package/src/primitives/textureVolume.js +46 -49
  28. package/src/primitives/tubeLines.js +108 -108
  29. package/src/primitives/zincObject.js +176 -184
  30. package/src/region.js +145 -155
  31. package/src/renderRequests.js +3 -3
  32. package/src/renderer.js +635 -620
  33. package/src/scene.js +479 -419
  34. package/src/sceneExporter.js +22 -17
  35. package/src/sceneLoader.js +542 -296
  36. package/src/shaders/rgbVolumeRender.js +11 -18
  37. package/src/shaders/textureArray.js +5 -12
  38. package/src/shaders/textureSlide.js +10 -17
  39. package/src/shaders/volumeRender.js +11 -18
  40. package/src/shaders/volumeRender_old.js +11 -18
  41. package/src/shaders/volumeTexture.js +7 -14
  42. package/src/textSprite.js +23 -19
  43. package/src/texture/texture.js +14 -15
  44. package/src/texture/textureArray.js +14 -16
  45. package/src/three/InstancedPoints.js +2 -9
  46. package/src/three/Loader.js +334 -315
  47. package/src/three/line/Line.js +165 -215
  48. package/src/three/line/LineSegments.js +40 -55
  49. package/src/three/line/LineSegments2.js +322 -366
  50. package/src/three/line/LineSegmentsGeometry.js +239 -280
  51. package/src/three-js-csg.js +260 -252
  52. package/src/tsl/glyphRenderMaterial.js +12 -3
  53. package/src/tsl/glyphTransform.js +51 -29
  54. package/src/tsl/textureSlides.js +23 -24
  55. package/src/utilities.js +309 -371
  56. package/src/videoHandler.js +76 -83
  57. package/src/workers/geometryCSG.worker.js +33 -36
  58. package/src/workers/geometryCSGInternal.js +39 -44
  59. package/src/zinc.js +4 -7
  60. package/vite.config.js +7 -7
package/src/scene.js CHANGED
@@ -10,24 +10,20 @@ import { SceneLoader } from './sceneLoader';
10
10
  import { Viewport } from './controls';
11
11
  import { createPointQuadGeometry } from './primitives/pointset';
12
12
  import { createInstancedPointsMaterial } from './tsl/pointsMaterial';
13
- import {
14
- createBufferGeometry,
15
- createNewSpriteText,
16
- getCircularTexture
17
- } from './utilities';
13
+ import { createBufferGeometry, createNewSpriteText, getCircularTexture } from './utilities';
18
14
 
19
15
  let uniqueiId = 0;
20
16
 
21
17
  const getUniqueId = function () {
22
- return "sc" + uniqueiId++;
23
- }
18
+ return 'sc' + uniqueiId++;
19
+ };
24
20
 
25
- const defaultMetadata = function() {
21
+ const defaultMetadata = function () {
26
22
  return {
27
- Duration: "6 secs",
28
- OriginalDuration: "-",
29
- TimeStamps: {}
30
- }
23
+ Duration: '6 secs',
24
+ OriginalDuration: '-',
25
+ TimeStamps: {},
26
+ };
31
27
  };
32
28
 
33
29
  const defaultDuration = 6000;
@@ -97,10 +93,10 @@ const Scene = function (containerIn, rendererIn) {
97
93
  y_offset: 16,
98
94
  width: 128,
99
95
  height: 128,
100
- align: "top-right",
101
- updateRequired: true
96
+ align: 'top-right',
97
+ updateRequired: true,
102
98
  };
103
- let scissor = {x: 0, y: 0};
99
+ let scissor = { x: 0, y: 0 };
104
100
  let metadata = defaultMetadata();
105
101
  let _markerTarget = new THREE.Vector2();
106
102
  let pickableObjectsList = [];
@@ -112,26 +108,22 @@ const Scene = function (containerIn, rendererIn) {
112
108
  let axisDisplay = {
113
109
  main: [],
114
110
  mini: [],
115
- }
116
- const _v3 = new THREE.Vector3( 0, 0, 0 );
111
+ };
112
+ const _v3 = new THREE.Vector3(0, 0, 0);
117
113
 
118
114
  const getDrawingWidth = () => {
119
115
  if (container)
120
- if (typeof container.clientWidth !== "undefined")
121
- return container.clientWidth;
122
- else
123
- return container.width;
116
+ if (typeof container.clientWidth !== 'undefined') return container.clientWidth;
117
+ else return container.width;
124
118
  return 0;
125
- }
119
+ };
126
120
 
127
121
  const getDrawingHeight = () => {
128
122
  if (container)
129
- if (typeof container.clientHeight !== "undefined")
130
- return container.clientHeight;
131
- else
132
- return container.height;
123
+ if (typeof container.clientHeight !== 'undefined') return container.clientHeight;
124
+ else return container.height;
133
125
  return 0;
134
- }
126
+ };
135
127
 
136
128
  /**
137
129
  * This function returns a three component array, which contains
@@ -141,7 +133,7 @@ const Scene = function (containerIn, rendererIn) {
141
133
  */
142
134
  this.getDownloadProgress = () => {
143
135
  return sceneLoader.getDownloadProgress();
144
- }
136
+ };
145
137
 
146
138
  //called from Renderer when panel has been resized
147
139
  this.onWindowResize = () => {
@@ -152,7 +144,7 @@ const Scene = function (containerIn, rendererIn) {
152
144
  this.minimapScissor.updateRequired = true;
153
145
  zincCameraControls.onResize();
154
146
  zincCameraControls.calculateHeightPerPixelAtZeroDepth(wHeight);
155
- }
147
+ };
156
148
 
157
149
  /**
158
150
  * Reset the viewport of this scene to its original state.
@@ -161,19 +153,24 @@ const Scene = function (containerIn, rendererIn) {
161
153
  needsRender = true;
162
154
  this.onWindowResize();
163
155
  zincCameraControls.resetView();
164
- }
156
+ };
165
157
 
166
158
  /**
167
159
  * Set the zoom level by unit scroll rate
168
160
  */
169
- this.changeZoomByScrollRateUnit = unit => {
161
+ this.changeZoomByScrollRateUnit = (unit) => {
170
162
  needsRender = true;
171
163
  zincCameraControls.changeZoomByScrollRateUnit(unit);
172
- }
164
+ };
173
165
 
174
166
  //Setup the camera for this scene, it also initialise the lighting
175
167
  const setupCamera = () => {
176
- this.camera = new THREE.PerspectiveCamera(40, getDrawingWidth() / getDrawingHeight(), 0.0, 10.0);
168
+ this.camera = new THREE.PerspectiveCamera(
169
+ 40,
170
+ getDrawingWidth() / getDrawingHeight(),
171
+ 0.0,
172
+ 10.0,
173
+ );
177
174
  this.ambient = new THREE.AmbientLight(0xffffff, 0.2);
178
175
  scene.add(this.ambient);
179
176
 
@@ -195,13 +192,13 @@ const Scene = function (containerIn, rendererIn) {
195
192
  *
196
193
  * @param {Zinc.Viewport} viewData - Viewport data to be loaded.
197
194
  */
198
- this.loadView = settings => {
195
+ this.loadView = (settings) => {
199
196
  needsRender = true;
200
197
  const viewPort = new Viewport();
201
198
  viewPort.setFromObject(settings);
202
199
  zincCameraControls.setCurrentCameraSettings(viewPort);
203
200
  return true;
204
- }
201
+ };
205
202
 
206
203
  /**
207
204
  * Set up multiple views.
@@ -215,7 +212,7 @@ const Scene = function (containerIn, rendererIn) {
215
212
  zincCameraControls.addViewport(name, viewport);
216
213
  }
217
214
  zincCameraControls.setDefaultViewport(defaultView);
218
- }
215
+ };
219
216
 
220
217
  /**
221
218
  * Get the bounding box of all the object in this scene only.
@@ -224,7 +221,7 @@ const Scene = function (containerIn, rendererIn) {
224
221
  */
225
222
  this.getBoundingBox = () => {
226
223
  return rootRegion.getBoundingBox(true);
227
- }
224
+ };
228
225
 
229
226
  /**
230
227
  * Adjust the viewport to display the desired volume provided by the bounding box.
@@ -232,7 +229,7 @@ const Scene = function (containerIn, rendererIn) {
232
229
  * @param {THREE.Box3} boundingBox - The bounding box which describes the volume of
233
230
  * which we the viewport should be displaying.
234
231
  */
235
- this.viewAllWithBoundingBox = boundingBox => {
232
+ this.viewAllWithBoundingBox = (boundingBox) => {
236
233
  needsRender = true;
237
234
  if (boundingBox) {
238
235
  const viewport = zincCameraControls.getViewportFromBoundingBox(boundingBox, 1.0);
@@ -240,7 +237,7 @@ const Scene = function (containerIn, rendererIn) {
240
237
  zincCameraControls.calculateHeightPerPixelAtZeroDepth(getDrawingHeight());
241
238
  markerCluster.markerUpdateRequired = true;
242
239
  }
243
- }
240
+ };
244
241
 
245
242
  /**
246
243
  * Adjust zoom distance to include all primitives in scene only.
@@ -250,7 +247,7 @@ const Scene = function (containerIn, rendererIn) {
250
247
  const boundingBox = this.getBoundingBox();
251
248
  this.viewAllWithBoundingBox(boundingBox);
252
249
  markerCluster.markerUpdateRequired = true;
253
- }
250
+ };
254
251
 
255
252
  /**
256
253
  * A function which iterates through the list of geometries and call the callback
@@ -258,9 +255,9 @@ const Scene = function (containerIn, rendererIn) {
258
255
  * @param {Function} callbackFunction - Callback function with the geometry
259
256
  * as an argument.
260
257
  */
261
- this.forEachGeometry = callbackFunction => {
258
+ this.forEachGeometry = (callbackFunction) => {
262
259
  rootRegion.forEachGeometry(callbackFunction, true);
263
- }
260
+ };
264
261
 
265
262
  /**
266
263
  * A function which iterates through the list of glyphsets and call the callback
@@ -268,9 +265,9 @@ const Scene = function (containerIn, rendererIn) {
268
265
  * @param {Function} callbackFunction - Callback function with the glyphset
269
266
  * as an argument.
270
267
  */
271
- this.forEachGlyphset = callbackFunction => {
268
+ this.forEachGlyphset = (callbackFunction) => {
272
269
  rootRegion.forEachGlyphset(callbackFunction, true);
273
- }
270
+ };
274
271
 
275
272
  /**
276
273
  * A function which iterates through the list of pointsets and call the callback
@@ -278,19 +275,19 @@ const Scene = function (containerIn, rendererIn) {
278
275
  * @param {Function} callbackFunction - Callback function with the pointset
279
276
  * as an argument.
280
277
  */
281
- this.forEachPointset = callbackFunction => {
278
+ this.forEachPointset = (callbackFunction) => {
282
279
  rootRegion.forEachPointset(callbackFunction, true);
283
- }
280
+ };
284
281
 
285
282
  /**
286
- * A function which iterates through the list of lines and call the callback
287
- * function with the lines as the argument.
288
- * @param {Function} callbackFunction - Callback function with the lines
289
- * as an argument.
290
- */
291
- this.forEachLine = callbackFunction => {
283
+ * A function which iterates through the list of lines and call the callback
284
+ * function with the lines as the argument.
285
+ * @param {Function} callbackFunction - Callback function with the lines
286
+ * as an argument.
287
+ */
288
+ this.forEachLine = (callbackFunction) => {
292
289
  rootRegion.forEachLine(callbackFunction, true);
293
- }
290
+ };
294
291
 
295
292
  /**
296
293
  * Find and return all geometries in this scene with the matching GroupName.
@@ -298,9 +295,9 @@ const Scene = function (containerIn, rendererIn) {
298
295
  * @param {String} GroupName - Groupname to match with.
299
296
  * @returns {Array}
300
297
  */
301
- this.findGeometriesWithGroupName = GroupName => {
298
+ this.findGeometriesWithGroupName = (GroupName) => {
302
299
  return rootRegion.findGeometriesWithGroupName(GroupName, true);
303
- }
300
+ };
304
301
 
305
302
  /**
306
303
  * Find and return all pointsets in this scene with the matching GroupName.
@@ -308,18 +305,18 @@ const Scene = function (containerIn, rendererIn) {
308
305
  * @param {String} GroupName - Groupname to match with.
309
306
  * @returns {Array}
310
307
  */
311
- this.findPointsetsWithGroupName = GroupName => {
308
+ this.findPointsetsWithGroupName = (GroupName) => {
312
309
  return rootRegion.findPointsetsWithGroupName(GroupName, true);
313
- }
310
+ };
314
311
  /**
315
312
  * Find and return all glyphsets in this scene with the matching GroupName.
316
313
  *
317
314
  * @param {String} GroupName - Groupname to match with.
318
315
  * @returns {Array}
319
316
  */
320
- this.findGlyphsetsWithGroupName = GroupName => {
317
+ this.findGlyphsetsWithGroupName = (GroupName) => {
321
318
  return rootRegion.findGlyphsetsWithGroupName(GroupName, true);
322
- }
319
+ };
323
320
 
324
321
  /**
325
322
  * Find and return all lines in this scene with the matching GroupName.
@@ -327,9 +324,9 @@ const Scene = function (containerIn, rendererIn) {
327
324
  * @param {String} GroupName - Groupname to match with.
328
325
  * @returns {Array}
329
326
  */
330
- this.findLinesWithGroupName = GroupName => {
327
+ this.findLinesWithGroupName = (GroupName) => {
331
328
  return rootRegion.findLinesWithGroupName(GroupName, true);
332
- }
329
+ };
333
330
 
334
331
  /**
335
332
  * Find a list of objects with the specified name, this will
@@ -339,13 +336,13 @@ const Scene = function (containerIn, rendererIn) {
339
336
  * @param {String} GroupName - Groupname to match with.
340
337
  * @returns {Array}
341
338
  */
342
- this.findObjectsWithGroupName = GroupName => {
339
+ this.findObjectsWithGroupName = (GroupName) => {
343
340
  return rootRegion.findObjectsWithGroupName(GroupName, true);
344
- }
341
+ };
345
342
 
346
- this.findObjectsWithAnatomicalId = anatomicalId => {
343
+ this.findObjectsWithAnatomicalId = (anatomicalId) => {
347
344
  return rootRegion.findObjectsWithAnatomicalId(anatomicalId, true);
348
- }
345
+ };
349
346
 
350
347
  /**
351
348
  * Get the bounding box of all zinc objects in list.
@@ -353,19 +350,17 @@ const Scene = function (containerIn, rendererIn) {
353
350
  * @param {Array} objectsArray - Groupname to match with.
354
351
  * @returns {THREE.Box3}
355
352
  */
356
- this.getBoundingBoxOfZincObjects = objectsArray => {
353
+ this.getBoundingBoxOfZincObjects = (objectsArray) => {
357
354
  let boundingBox = undefined;
358
355
  for (let i = 0; i < objectsArray.length; i++) {
359
356
  let box = objectsArray[i].getBoundingBox();
360
357
  if (box) {
361
- if (!boundingBox)
362
- boundingBox = box;
363
- else
364
- boundingBox.union(box);
358
+ if (!boundingBox) boundingBox = box;
359
+ else boundingBox.union(box);
365
360
  }
366
361
  }
367
362
  return boundingBox;
368
- }
363
+ };
369
364
 
370
365
  /**
371
366
  * Convert the vector3 into screen coordinates.
@@ -375,16 +370,16 @@ const Scene = function (containerIn, rendererIn) {
375
370
  * @param {Array} objectsArray - Groupname to match with.
376
371
  * @returns {THREE.Vector3}
377
372
  */
378
- this.vectorToScreenXY = point => {
373
+ this.vectorToScreenXY = (point) => {
379
374
  point.project(this.camera);
380
375
  let width = getDrawingWidth();
381
376
  let height = getDrawingHeight();
382
- let widthHalf = (width / 2);
383
- let heightHalf = (height / 2);
384
- point.x = (point.x * widthHalf) + widthHalf;
385
- point.y = - (point.y * heightHalf) + heightHalf;
377
+ let widthHalf = width / 2;
378
+ let heightHalf = height / 2;
379
+ point.x = point.x * widthHalf + widthHalf;
380
+ point.y = -(point.y * heightHalf) + heightHalf;
386
381
  return point;
387
- }
382
+ };
388
383
 
389
384
  /**
390
385
  * Get the screen coordinate of the centroid of provided list of objects.
@@ -392,7 +387,7 @@ const Scene = function (containerIn, rendererIn) {
392
387
  * @param {Array} zincObjects - List of {@link ZincObject}.
393
388
  * @returns {THREE.Vector3}
394
389
  */
395
- this.getObjectsScreenXY = zincObjects => {
390
+ this.getObjectsScreenXY = (zincObjects) => {
396
391
  if (zincObjects && zincObjects.length > 0) {
397
392
  let boundingBox = this.getBoundingBoxOfZincObjects(zincObjects);
398
393
  const center = new THREE.Vector3();
@@ -400,7 +395,7 @@ const Scene = function (containerIn, rendererIn) {
400
395
  return this.vectorToScreenXY(center);
401
396
  }
402
397
  return undefined;
403
- }
398
+ };
404
399
 
405
400
  /**
406
401
  * Get the screen coordinate of the centroid of all objects
@@ -409,7 +404,7 @@ const Scene = function (containerIn, rendererIn) {
409
404
  * @param {String} name - List of {@link ZincObject}.
410
405
  * @returns {THREE.Vector3}
411
406
  */
412
- this.getNamedObjectsScreenXY = name => {
407
+ this.getNamedObjectsScreenXY = (name) => {
413
408
  let zincObjects = this.findObjectsWithGroupName(name);
414
409
  return this.getObjectsScreenXY(zincObjects);
415
410
  };
@@ -420,14 +415,13 @@ const Scene = function (containerIn, rendererIn) {
420
415
  * @param {ZincObject} - zinc object ot be added.
421
416
  * @returns {THREE.Vector3}
422
417
  */
423
- this.addZincObject = zincObject => {
418
+ this.addZincObject = (zincObject) => {
424
419
  needsRender = true;
425
420
  if (zincObject) {
426
421
  rootRegion.addZincObject(zincObject);
427
- if (zincCameraControls)
428
- zincCameraControls.calculateMaxAllowedDistance(this);
422
+ if (zincCameraControls) zincCameraControls.calculateMaxAllowedDistance(this);
429
423
  }
430
- }
424
+ };
431
425
 
432
426
  /**
433
427
  * Load a glyphset into this scene object.
@@ -441,7 +435,7 @@ const Scene = function (containerIn, rendererIn) {
441
435
  */
442
436
  this.loadGlyphsetURL = (metaurl, glyphurl, groupName, finishCallback) => {
443
437
  sceneLoader.loadGlyphsetURL(rootRegion, metaurl, glyphurl, groupName, finishCallback);
444
- }
438
+ };
445
439
 
446
440
  /**
447
441
  * Load a pointset into this scene object.
@@ -455,36 +449,43 @@ const Scene = function (containerIn, rendererIn) {
455
449
  * once the glyphset is succssfully load in.
456
450
  */
457
451
  this.loadPointsetURL = (url, timeEnabled, morphColour, groupName, finishCallback) => {
458
- sceneLoader.loadPointsetURL(rootRegion, url, timeEnabled, morphColour, groupName, finishCallback);
459
- }
452
+ sceneLoader.loadPointsetURL(
453
+ rootRegion,
454
+ url,
455
+ timeEnabled,
456
+ morphColour,
457
+ groupName,
458
+ finishCallback,
459
+ );
460
+ };
460
461
 
461
462
  /**
462
- * Load lines into this scene object.
463
- *
464
- * @param {String} metaurl - Provide informations such as transformations, colours
465
- * and others for each of the glyph in the glyphsset.
466
- * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
467
- * @param {Boolean} morphColour - Indicate if color morphing is enabled.
468
- * @param {STRING} groupName - name to assign the pointset's groupname to.
469
- * @param {Function} finishCallback - Callback function which will be called
470
- * once the glyphset is succssfully load in.
471
- */
463
+ * Load lines into this scene object.
464
+ *
465
+ * @param {String} metaurl - Provide informations such as transformations, colours
466
+ * and others for each of the glyph in the glyphsset.
467
+ * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
468
+ * @param {Boolean} morphColour - Indicate if color morphing is enabled.
469
+ * @param {STRING} groupName - name to assign the pointset's groupname to.
470
+ * @param {Function} finishCallback - Callback function which will be called
471
+ * once the glyphset is succssfully load in.
472
+ */
472
473
  this.loadLinesURL = (url, timeEnabled, morphColour, groupName, finishCallback) => {
473
474
  sceneLoader.loadLinesURL(rootRegion, url, timeEnabled, morphColour, groupName, finishCallback);
474
- }
475
+ };
475
476
 
476
477
  /**
477
- * Read a STL file into this scene, the geometry will be presented as
478
- * {@link Zinc.Geometry}.
479
- *
480
- * @param {STRING} url - location to the STL file.
481
- * @param {STRING} groupName - name to assign the geometry's groupname to.
482
- * @param {Function} finishCallback - Callback function which will be called
483
- * once the STL geometry is succssfully loaded.
484
- */
478
+ * Read a STL file into this scene, the geometry will be presented as
479
+ * {@link Zinc.Geometry}.
480
+ *
481
+ * @param {STRING} url - location to the STL file.
482
+ * @param {STRING} groupName - name to assign the geometry's groupname to.
483
+ * @param {Function} finishCallback - Callback function which will be called
484
+ * once the STL geometry is succssfully loaded.
485
+ */
485
486
  this.loadSTL = (url, groupName, finishCallback) => {
486
487
  sceneLoader.loadSTL(rootRegion, url, groupName, finishCallback);
487
- }
488
+ };
488
489
 
489
490
  /**
490
491
  * Read a OBJ file into this scene, the geometry will be presented as
@@ -497,7 +498,7 @@ const Scene = function (containerIn, rendererIn) {
497
498
  */
498
499
  this.loadOBJ = (url, groupName, finishCallback) => {
499
500
  sceneLoader.loadOBJ(rootRegion, url, groupName, finishCallback);
500
- }
501
+ };
501
502
 
502
503
  /**
503
504
  * Load a metadata file from the provided URL into this scene. Once
@@ -507,11 +508,11 @@ const Scene = function (containerIn, rendererIn) {
507
508
  * @param {Function} finishCallback - Callback function which will be called
508
509
  * for each glyphset and geometry that has been written in.
509
510
  * @param {options} Optional settings, it can be used to ignore some regions/groups
510
- * in the metadata file. Only supports version 1 at this moment.
511
+ * in the metadata file. Only supports version 1 at this moment.
511
512
  */
512
513
  this.loadMetadataURL = (url, finishCallback, allCompletedCallback, options) => {
513
514
  sceneLoader.loadMetadataURL(rootRegion, url, finishCallback, allCompletedCallback, options);
514
- }
515
+ };
515
516
 
516
517
  /**
517
518
  * Load a legacy model(s) format with the provided URLs and parameters. This only loads the geometry
@@ -520,16 +521,23 @@ const Scene = function (containerIn, rendererIn) {
520
521
  * @deprecated
521
522
  */
522
523
  this.loadModelsURL = (urls, colours, opacities, timeEnabled, morphColour, finishCallback) => {
523
- sceneLoader.loadModelsURL(rootRegion. urls, colours, opacities, timeEnabled, morphColour, finishCallback);
524
- }
524
+ sceneLoader.loadModelsURL(
525
+ rootRegion.urls,
526
+ colours,
527
+ opacities,
528
+ timeEnabled,
529
+ morphColour,
530
+ finishCallback,
531
+ );
532
+ };
525
533
 
526
534
  /**
527
535
  * Load the viewport from an external location provided by the url.
528
536
  * @param {String} URL - address to the file containing viewport information.
529
537
  */
530
- this.loadViewURL = url => {
538
+ this.loadViewURL = (url) => {
531
539
  sceneLoader.loadViewURL(url);
532
- }
540
+ };
533
541
 
534
542
  /**
535
543
  * Load a legacy file format containing the viewport and its meta file from an external
@@ -541,38 +549,38 @@ const Scene = function (containerIn, rendererIn) {
541
549
  */
542
550
  this.loadFromViewURL = (jsonFilePrefix, finishCallback) => {
543
551
  sceneLoader.loadFromViewURL(jsonFilePrefix, finishCallback);
544
- }
552
+ };
545
553
 
546
554
  /**
547
555
  * Load GLTF into this scene object.
548
556
  */
549
557
  this.loadGLTF = (url, finishCallback, allCompletedCallback, options) => {
550
558
  sceneLoader.loadGLTF(rootRegion, url, finishCallback, allCompletedCallback, options);
551
- }
559
+ };
552
560
 
553
561
  //Update the directional light for this scene.
554
562
  this.updateDirectionalLight = () => {
555
563
  needsRender = true;
556
564
  zincCameraControls.updateDirectionalLight();
557
- }
565
+ };
558
566
 
559
567
  /**
560
568
  * Add any {THREE.Object} into this scene.
561
569
  * @param {THREE.Object} object - to be addded into this scene.
562
570
  */
563
- this.addObject = object => {
571
+ this.addObject = (object) => {
564
572
  needsRender = true;
565
573
  scene.add(object);
566
- }
574
+ };
567
575
 
568
576
  /**
569
577
  * Remove any {THREE.Object} from this scene.
570
578
  * @param {THREE.Object} object - to be removed from this scene.
571
579
  */
572
- this.removeObject = object => {
580
+ this.removeObject = (object) => {
573
581
  needsRender = true;
574
582
  scene.remove(object);
575
- }
583
+ };
576
584
 
577
585
  /**
578
586
  * Get the current time of the scene.
@@ -583,11 +591,10 @@ const Scene = function (containerIn, rendererIn) {
583
591
  return videoHandler.getCurrentTime(duration);
584
592
  }
585
593
  const time = rootRegion.getCurrentTime();
586
- if (time !== -1)
587
- return time;
594
+ if (time !== -1) return time;
588
595
 
589
596
  return 0;
590
- }
597
+ };
591
598
 
592
599
  /**
593
600
  * Set the current time of all the geometries and glyphsets of this scene.
@@ -599,7 +606,7 @@ const Scene = function (containerIn, rendererIn) {
599
606
  videoHandler.setMorphTime(time, duration);
600
607
  }
601
608
  rootRegion.setMorphTime(time, true);
602
- }
609
+ };
603
610
 
604
611
  /**
605
612
  * Check if any object in this scene is time varying.
@@ -608,10 +615,10 @@ const Scene = function (containerIn, rendererIn) {
608
615
  */
609
616
  this.isTimeVarying = () => {
610
617
  if (videoHandler && videoHandler.video && !videoHandler.video.error) {
611
- return true;
618
+ return true;
612
619
  }
613
620
  return rootRegion.isTimeVarying();
614
- }
621
+ };
615
622
 
616
623
  /**
617
624
  * Update geometries and glyphsets based on the calculated time.
@@ -629,7 +636,7 @@ const Scene = function (containerIn, rendererIn) {
629
636
  options.camera = cameraControls;
630
637
  //Global markers flag, marker can be set at individual zinc object level
631
638
  //overriding this flag.
632
- options.displayMarkers = this.displayMarkers;
639
+ options.displayMarkers = this.displayMarkers;
633
640
  options.markerCluster = markerCluster;
634
641
  options.markersList = markerCluster.markers;
635
642
  options.ndcToBeUpdated = sharedCamera ? sharedCamera.updated : false;
@@ -638,36 +645,35 @@ const Scene = function (containerIn, rendererIn) {
638
645
  if (playAnimation) {
639
646
  options.markerCluster.markerUpdateRequired = true;
640
647
  }
641
- if (videoHandler) {
642
- if (videoHandler.isReadyToPlay()) {
643
- if (playAnimation) {
648
+ if (videoHandler) {
649
+ if (videoHandler.isReadyToPlay()) {
650
+ if (playAnimation) {
644
651
  videoHandler.video.play();
645
- } else {
646
- videoHandler.video.pause();
647
- }
648
- const currentTime = videoHandler.video.currentTime /
649
- videoHandler.getVideoDuration() * duration;
650
- if (0 == sceneLoader.toBeDownloaded) {
651
- if (!sharedCamera) {
652
- zincCameraControls.setTime(currentTime);
653
- options.ndcToBeUpdated = zincCameraControls.update(0);
652
+ } else {
653
+ videoHandler.video.pause();
654
+ }
655
+ const currentTime =
656
+ (videoHandler.video.currentTime / videoHandler.getVideoDuration()) * duration;
657
+ if (0 == sceneLoader.toBeDownloaded) {
658
+ if (!sharedCamera) {
659
+ zincCameraControls.setTime(currentTime);
660
+ options.ndcToBeUpdated = zincCameraControls.update(0);
654
661
  if (options.ndcToBeUpdated) {
655
662
  zincCameraControls.calculateHeightPerPixelAtZeroDepth(getDrawingHeight());
656
663
  }
657
664
  }
658
665
  rootRegion.setMorphTime(currentTime, true);
659
666
  rootRegion.renderGeometries(0, 0, playAnimation, cameraControls, options, true);
660
- } else if (!sharedCamera && zincCameraControls.update(0)) {
661
- changed = true;
662
- cameraUpdated = true;
663
- }
664
- //console.log(videoHandler.video.currentTime / videoHandler.getVideoDuration() * 6000);
665
- }
666
- //The video texture changes while playing or loading
667
- if (playAnimation || !videoHandler.isReadyToPlay())
668
- changed = true;
669
- } else {
670
- if (0 == sceneLoader.toBeDownloaded) {
667
+ } else if (!sharedCamera && zincCameraControls.update(0)) {
668
+ changed = true;
669
+ cameraUpdated = true;
670
+ }
671
+ //console.log(videoHandler.video.currentTime / videoHandler.getVideoDuration() * 6000);
672
+ }
673
+ //The video texture changes while playing or loading
674
+ if (playAnimation || !videoHandler.isReadyToPlay()) changed = true;
675
+ } else {
676
+ if (0 == sceneLoader.toBeDownloaded) {
671
677
  if (!sharedCamera) {
672
678
  options.ndcToBeUpdated = zincCameraControls.update(delta);
673
679
  if (options.ndcToBeUpdated) {
@@ -675,16 +681,18 @@ const Scene = function (containerIn, rendererIn) {
675
681
  }
676
682
  }
677
683
  rootRegion.renderGeometries(playRate, delta, playAnimation, cameraControls, options, true);
678
- } else if (!sharedCamera && zincCameraControls.update(0)) {
679
- changed = true;
680
- cameraUpdated = true;
681
- }
684
+ } else if (!sharedCamera && zincCameraControls.update(0)) {
685
+ changed = true;
686
+ cameraUpdated = true;
687
+ }
682
688
  }
683
689
  //These are plain properties, check if they have changed
684
- if (lastDisplayState.displayMarkers !== this.displayMarkers ||
690
+ if (
691
+ lastDisplayState.displayMarkers !== this.displayMarkers ||
685
692
  lastDisplayState.displayMinimap !== this.displayMinimap ||
686
693
  lastDisplayState.displayMiniAxes !== this.displayMiniAxes ||
687
- lastDisplayState.playAnimation !== playAnimation) {
694
+ lastDisplayState.playAnimation !== playAnimation
695
+ ) {
688
696
  lastDisplayState.displayMarkers = this.displayMarkers;
689
697
  lastDisplayState.displayMinimap = this.displayMinimap;
690
698
  lastDisplayState.displayMiniAxes = this.displayMiniAxes;
@@ -692,18 +700,18 @@ const Scene = function (containerIn, rendererIn) {
692
700
  changed = true;
693
701
  }
694
702
  //The flag is only cleared when the minimap is drawn
695
- if (this.minimapScissor.updateRequired &&
696
- (this.displayMinimap || this.displayMiniAxes)) {
703
+ if (this.minimapScissor.updateRequired && (this.displayMinimap || this.displayMiniAxes)) {
697
704
  changed = true;
698
705
  }
699
- if (!sharedCamera && options.ndcToBeUpdated)
700
- cameraUpdated = true;
701
- if (options.ndcToBeUpdated ||
706
+ if (!sharedCamera && options.ndcToBeUpdated) cameraUpdated = true;
707
+ if (
708
+ options.ndcToBeUpdated ||
702
709
  (playAnimation && this.isTimeVarying()) ||
703
710
  //Objects appear as they are loaded
704
711
  sceneLoader.toBeDownloaded > 0 ||
705
712
  //Clusters are recalculated on a later frame
706
- (markerCluster.isEnabled() && markerCluster.markerUpdateRequired)) {
713
+ (markerCluster.isEnabled() && markerCluster.markerUpdateRequired)
714
+ ) {
707
715
  changed = true;
708
716
  }
709
717
  //Changes made during this frame, e.g. LOD switching
@@ -712,7 +720,7 @@ const Scene = function (containerIn, rendererIn) {
712
720
  needsRender = false;
713
721
  }
714
722
  return changed;
715
- }
723
+ };
716
724
 
717
725
  /**
718
726
  * Request this scene to be drawn on the next frame, this is only
@@ -721,7 +729,7 @@ const Scene = function (containerIn, rendererIn) {
721
729
  */
722
730
  this.invalidate = () => {
723
731
  needsRender = true;
724
- }
732
+ };
725
733
 
726
734
  /**
727
735
  * Check if the camera of this scene has been updated during the last
@@ -732,7 +740,7 @@ const Scene = function (containerIn, rendererIn) {
732
740
  */
733
741
  this.isCameraUpdated = () => {
734
742
  return cameraUpdated;
735
- }
743
+ };
736
744
 
737
745
  /**
738
746
  * Return the internal {THREE.Scene}.
@@ -740,67 +748,78 @@ const Scene = function (containerIn, rendererIn) {
740
748
  */
741
749
  this.getThreeJSScene = () => {
742
750
  return scene;
743
- }
751
+ };
744
752
 
745
753
  this.setVideoHandler = (videoHandlerIn) => {
746
754
  needsRender = true;
747
- if (!videoHandler)
748
- videoHandler = videoHandlerIn;
749
- }
755
+ if (!videoHandler) videoHandler = videoHandlerIn;
756
+ };
750
757
 
751
758
  /**
752
759
  * Set a group of scenes into this parent scene. This group of
753
760
  * scenes will also be rendered when this scene is rendered.
754
761
  * @private
755
762
  */
756
- this.setAdditionalScenesGroup = scenesGroup => {
763
+ this.setAdditionalScenesGroup = (scenesGroup) => {
757
764
  scene.add(scenesGroup);
758
- }
765
+ };
759
766
 
760
- let getWindowsPosition = (align, x_offset, y_offset, width, height,
761
- renderer_width, renderer_height) => {
767
+ let getWindowsPosition = (
768
+ align,
769
+ x_offset,
770
+ y_offset,
771
+ width,
772
+ height,
773
+ renderer_width,
774
+ renderer_height,
775
+ ) => {
762
776
  let x = 0;
763
777
  let y = 0;
764
- if (align.includes("top")) {
778
+ if (align.includes('top')) {
765
779
  y = renderer_height - height - y_offset;
766
- } else if (align.includes("bottom")) {
780
+ } else if (align.includes('bottom')) {
767
781
  y = y_offset;
768
782
  } else {
769
783
  y = Math.floor((renderer_height - height) / 2.0);
770
784
  }
771
- if (align.includes("left")) {
785
+ if (align.includes('left')) {
772
786
  x = x_offset;
773
- } else if (align.includes("right")) {
774
- x = renderer_width - x_offset- width;
787
+ } else if (align.includes('right')) {
788
+ x = renderer_width - x_offset - width;
775
789
  } else {
776
790
  x = Math.floor((renderer_width - width) / 2.0);
777
791
  }
778
- return {x: x, y: y};
779
- }
792
+ return { x: x, y: y };
793
+ };
780
794
 
781
- const renderMinimap = renderer => {
795
+ const renderMinimap = (renderer) => {
782
796
  if (this.displayMinimap || this.displayMiniAxes) {
783
797
  renderer.setScissorTest(true);
784
798
  renderer.getSize(_markerTarget);
785
799
  if (this.minimapScissor.updateRequired) {
786
- scissor = getWindowsPosition(this.minimapScissor.align,
800
+ scissor = getWindowsPosition(
801
+ this.minimapScissor.align,
787
802
  this.minimapScissor.x_offset,
788
803
  this.minimapScissor.y_offset,
789
804
  this.minimapScissor.width,
790
805
  this.minimapScissor.height,
791
- _markerTarget.x, _markerTarget.y);
806
+ _markerTarget.x,
807
+ _markerTarget.y,
808
+ );
792
809
  this.minimapScissor.updateRequired = false;
793
810
  }
794
811
  renderer.setScissor(
795
812
  scissor.x,
796
813
  scissor.y,
797
814
  this.minimapScissor.width,
798
- this.minimapScissor.height);
815
+ this.minimapScissor.height,
816
+ );
799
817
  renderer.setViewport(
800
818
  scissor.x,
801
819
  scissor.y,
802
820
  this.minimapScissor.width,
803
- this.minimapScissor.height);
821
+ this.minimapScissor.height,
822
+ );
804
823
  minimap.updateCamera();
805
824
  if (this.displayMiniAxes) {
806
825
  renderer.render(miniAxesScene, minimap.camera);
@@ -812,22 +831,21 @@ const Scene = function (containerIn, rendererIn) {
812
831
  renderer.setScissorTest(false);
813
832
  renderer.setViewport(0, 0, _markerTarget.x, _markerTarget.y);
814
833
  }
815
- }
834
+ };
816
835
 
817
836
  /**
818
837
  * Render the scene.
819
838
  * @private
820
839
  */
821
- this.render = renderer => {
822
- if (this.autoClearFlag)
823
- renderer.clear();
840
+ this.render = (renderer) => {
841
+ if (this.autoClearFlag) renderer.clear();
824
842
  if (stereoEffectFlag && stereoEffect) {
825
843
  stereoEffect.render(scene, this.camera);
826
844
  } else {
827
845
  renderer.render(scene, this.camera);
828
846
  renderMinimap(renderer);
829
847
  }
830
- }
848
+ };
831
849
 
832
850
  /**
833
851
  * Enable or disable interactive control, this is on by default.
@@ -835,12 +853,10 @@ const Scene = function (containerIn, rendererIn) {
835
853
  * @param {Boolean} flag - Indicate either interactive control
836
854
  * should be enabled or disabled.
837
855
  */
838
- this.setInteractiveControlEnable = flag => {
839
- if (flag == true)
840
- zincCameraControls.enable();
841
- else
842
- zincCameraControls.disable();
843
- }
856
+ this.setInteractiveControlEnable = (flag) => {
857
+ if (flag == true) zincCameraControls.enable();
858
+ else zincCameraControls.disable();
859
+ };
844
860
 
845
861
  /**
846
862
  * Get the camera control of this scene.
@@ -848,7 +864,7 @@ const Scene = function (containerIn, rendererIn) {
848
864
  */
849
865
  this.getZincCameraControls = () => {
850
866
  return zincCameraControls;
851
- }
867
+ };
852
868
 
853
869
  /**
854
870
  * Get the internal {THREE.Scene}.
@@ -856,20 +872,20 @@ const Scene = function (containerIn, rendererIn) {
856
872
  */
857
873
  this.getThreeJSScene = () => {
858
874
  return scene;
859
- }
875
+ };
860
876
 
861
877
  /**
862
878
  * Set the default duration value for geometries and glyphsets
863
879
  * that are to be loaded into this scene.
864
880
  * @param {Number} durationIn - duration of the scene.
865
881
  */
866
- this.setDuration = durationIn => {
882
+ this.setDuration = (durationIn) => {
867
883
  needsRender = true;
868
884
  rootRegion.setDuration(durationIn);
869
885
  duration = durationIn;
870
886
  zincCameraControls.setPathDuration(durationIn);
871
887
  sceneLoader.duration = durationIn;
872
- }
888
+ };
873
889
 
874
890
  /**
875
891
  * Get the default duration value.
@@ -877,14 +893,14 @@ const Scene = function (containerIn, rendererIn) {
877
893
  */
878
894
  this.getDuration = () => {
879
895
  return duration;
880
- }
896
+ };
881
897
 
882
898
  /**
883
899
  * Enable or disable stereo effect of this scene.
884
900
  * @param {Boolean} stereoFlag - Indicate either stereo effect control
885
901
  * should be enabled or disabled.
886
902
  */
887
- this.setStereoEffectEnable = stereoFlag => {
903
+ this.setStereoEffectEnable = (stereoFlag) => {
888
904
  needsRender = true;
889
905
  if (stereoFlag == true) {
890
906
  if (!stereoEffect) {
@@ -894,17 +910,16 @@ const Scene = function (containerIn, rendererIn) {
894
910
  rendererIn.setSize(getDrawingWidth(), getDrawingHeight());
895
911
  this.camera.updateProjectionMatrix();
896
912
  stereoEffectFlag = stereoFlag;
897
- }
898
-
913
+ };
899
914
 
900
915
  /**
901
916
  * Check rather object is in scene.
902
917
  *
903
918
  * @return {Boolean}
904
919
  */
905
- this.objectIsInScene = zincObject => {
920
+ this.objectIsInScene = (zincObject) => {
906
921
  return rootRegion.objectIsInRegion(zincObject, true);
907
- }
922
+ };
908
923
 
909
924
  /**
910
925
  * Rotate the camera view to view the entirety of the
@@ -919,10 +934,16 @@ const Scene = function (containerIn, rendererIn) {
919
934
  if (boundingBox) {
920
935
  boundingBox.getCenter(_v3);
921
936
  const viewport = this.getZincCameraControls().getCurrentViewport();
922
- const target = new THREE.Vector3(viewport.targetPosition[0],
923
- viewport.targetPosition[1], viewport.targetPosition[2]);
924
- const eyePosition = new THREE.Vector3(viewport.eyePosition[0],
925
- viewport.eyePosition[1], viewport.eyePosition[2]);
937
+ const target = new THREE.Vector3(
938
+ viewport.targetPosition[0],
939
+ viewport.targetPosition[1],
940
+ viewport.targetPosition[2],
941
+ );
942
+ const eyePosition = new THREE.Vector3(
943
+ viewport.eyePosition[0],
944
+ viewport.eyePosition[1],
945
+ viewport.eyePosition[2],
946
+ );
926
947
  const newVec1 = new THREE.Vector3();
927
948
  const newVec2 = new THREE.Vector3();
928
949
  newVec1.subVectors(target, eyePosition).normalize();
@@ -931,16 +952,14 @@ const Scene = function (containerIn, rendererIn) {
931
952
  newVec3.crossVectors(newVec1, newVec2);
932
953
  const angle = newVec1.angleTo(newVec2);
933
954
  if (transitionTime > 0) {
934
- this.getZincCameraControls().rotateCameraTransition(newVec3,
935
- angle, transitionTime);
955
+ this.getZincCameraControls().rotateCameraTransition(newVec3, angle, transitionTime);
936
956
  this.getZincCameraControls().enableCameraTransition();
937
957
  } else {
938
958
  this.getZincCameraControls().rotateAboutLookAtpoint(newVec3, angle);
939
959
  }
940
960
  markerCluster.markerUpdateRequired = true;
941
961
  }
942
- }
943
-
962
+ };
944
963
 
945
964
  /**
946
965
  * Translate the camera view to the center of the
@@ -953,15 +972,17 @@ const Scene = function (containerIn, rendererIn) {
953
972
  this.translateBoundingBoxToCameraView = (boundingBox, scaleRadius, transitionTime) => {
954
973
  if (boundingBox) {
955
974
  const oldViewport = this.getZincCameraControls().getCurrentViewport();
956
- const viewport = this.getZincCameraControls().getViewportFromBoundingBox(boundingBox, scaleRadius);
975
+ const viewport = this.getZincCameraControls().getViewportFromBoundingBox(
976
+ boundingBox,
977
+ scaleRadius,
978
+ );
957
979
  if (transitionTime > 0) {
958
- this.getZincCameraControls().cameraTransition(oldViewport,
959
- viewport, transitionTime);
980
+ this.getZincCameraControls().cameraTransition(oldViewport, viewport, transitionTime);
960
981
  this.getZincCameraControls().enableCameraTransition();
961
982
  }
962
983
  markerCluster.markerUpdateRequired = true;
963
984
  }
964
- }
985
+ };
965
986
 
966
987
  /**
967
988
  * Transition the camera into viewing the zinc object with a
@@ -975,23 +996,29 @@ const Scene = function (containerIn, rendererIn) {
975
996
  const boundingBox = zincObject.getBoundingBox();
976
997
  this.alignBoundingBoxToCameraView(boundingBox, transitionTime);
977
998
  }
978
- }
999
+ };
979
1000
 
980
1001
  /**
981
1002
  * Set the camera to point to the centroid of the zinc object.
982
1003
  *
983
1004
  * @param {ZincObject} zincObject - the bounding box to target
984
1005
  */
985
- this.setCameraTargetToObject = zincObject => {
1006
+ this.setCameraTargetToObject = (zincObject) => {
986
1007
  needsRender = true;
987
1008
  if (this.objectIsInScene(zincObject)) {
988
1009
  const boundingBox = zincObject.getBoundingBox();
989
1010
  const viewport = this.getZincCameraControls().getCurrentViewport();
990
1011
  boundingBox.getCenter(_v3);
991
- const target = new THREE.Vector3(viewport.targetPosition[0],
992
- viewport.targetPosition[1], viewport.targetPosition[2]);
993
- const eyePosition = new THREE.Vector3(viewport.eyePosition[0],
994
- viewport.eyePosition[1], viewport.eyePosition[2]);
1012
+ const target = new THREE.Vector3(
1013
+ viewport.targetPosition[0],
1014
+ viewport.targetPosition[1],
1015
+ viewport.targetPosition[2],
1016
+ );
1017
+ const eyePosition = new THREE.Vector3(
1018
+ viewport.eyePosition[0],
1019
+ viewport.eyePosition[1],
1020
+ viewport.eyePosition[2],
1021
+ );
995
1022
  const newVec1 = new THREE.Vector3();
996
1023
  const newVec2 = new THREE.Vector3();
997
1024
  newVec1.subVectors(eyePosition, target);
@@ -1005,7 +1032,7 @@ const Scene = function (containerIn, rendererIn) {
1005
1032
  this.getZincCameraControls().setCurrentCameraSettings(viewport);
1006
1033
  markerCluster.markerUpdateRequired = true;
1007
1034
  }
1008
- }
1035
+ };
1009
1036
 
1010
1037
  /**
1011
1038
  * Check if stereo effect is enabled.
@@ -1013,21 +1040,21 @@ const Scene = function (containerIn, rendererIn) {
1013
1040
  */
1014
1041
  this.isStereoEffectEnable = () => {
1015
1042
  return stereoEffectFlag;
1016
- }
1043
+ };
1017
1044
 
1018
1045
  /**
1019
1046
  * Remove a ZincObject from this scene if it presents. This will eventually
1020
1047
  * destroy the object and free up the memory.
1021
1048
  * @param {Zinc.Object} zincObject - object to be removed from this scene.
1022
1049
  */
1023
- this.removeZincObject = zincObject => {
1050
+ this.removeZincObject = (zincObject) => {
1024
1051
  needsRender = true;
1025
1052
  rootRegion.removeZincObject(zincObject);
1026
1053
  if (zincCameraControls) {
1027
1054
  zincCameraControls.calculateMaxAllowedDistance(this);
1028
1055
  }
1029
1056
  markerCluster.markerUpdateRequired = true;
1030
- }
1057
+ };
1031
1058
 
1032
1059
  /**
1033
1060
  * Update pickable objects list
@@ -1039,7 +1066,7 @@ const Scene = function (containerIn, rendererIn) {
1039
1066
  }
1040
1067
  rootRegion.getPickableThreeJSObjects(pickableObjectsList, true);
1041
1068
  this.forcePickableObjectsUpdate = false;
1042
- }
1069
+ };
1043
1070
 
1044
1071
  /**
1045
1072
  * Get all pickable objects.
@@ -1047,12 +1074,11 @@ const Scene = function (containerIn, rendererIn) {
1047
1074
  this.getPickableThreeJSObjects = () => {
1048
1075
  //The list will only be updated if changes have been made
1049
1076
  //in region or a flag has been raise
1050
- if (this.forcePickableObjectsUpdate ||
1051
- rootRegion.checkPickableUpdateRequred(true)) {
1077
+ if (this.forcePickableObjectsUpdate || rootRegion.checkPickableUpdateRequred(true)) {
1052
1078
  this.updatePickableThreeJSObjects();
1053
1079
  }
1054
1080
  return pickableObjectsList;
1055
- }
1081
+ };
1056
1082
 
1057
1083
  /**
1058
1084
  * Get the Normalised coordinates on minimap if mouse event is
@@ -1063,29 +1089,28 @@ const Scene = function (containerIn, rendererIn) {
1063
1089
  const target = new THREE.Vector2();
1064
1090
  renderer.getSize(target);
1065
1091
  let offsetY = target.y - event.clientY;
1066
- if (((scissor.x + this.minimapScissor.width) > event.clientX) &&
1067
- (event.clientX > scissor.x) &&
1068
- ((scissor.y + this.minimapScissor.height) > offsetY) &&
1069
- (offsetY > scissor.y)) {
1070
- let x = ((event.clientX - scissor.x) /
1071
- this.minimapScissor.width) * 2.0 - 1.0;
1072
- let y = ((offsetY - scissor.y) /
1073
- this.minimapScissor.height) * 2.0 - 1.0;
1074
- return {"x": x, "y": y};
1092
+ if (
1093
+ scissor.x + this.minimapScissor.width > event.clientX &&
1094
+ event.clientX > scissor.x &&
1095
+ scissor.y + this.minimapScissor.height > offsetY &&
1096
+ offsetY > scissor.y
1097
+ ) {
1098
+ let x = ((event.clientX - scissor.x) / this.minimapScissor.width) * 2.0 - 1.0;
1099
+ let y = ((offsetY - scissor.y) / this.minimapScissor.height) * 2.0 - 1.0;
1100
+ return { x: x, y: y };
1075
1101
  }
1076
1102
  }
1077
1103
  return undefined;
1078
- }
1104
+ };
1079
1105
 
1080
1106
  /**
1081
1107
  * Get the coordinates difference of the current viewing
1082
1108
  * point and projected coordinates.
1083
1109
  */
1084
1110
  this.getMinimapDiffFromNormalised = (x, y) => {
1085
- if (minimap)
1086
- return minimap.getDiffFromNormalised(x, y);
1111
+ if (minimap) return minimap.getDiffFromNormalised(x, y);
1087
1112
  return undefined;
1088
- }
1113
+ };
1089
1114
 
1090
1115
  /**
1091
1116
  * Check if the renderer is running on the WebGL 2 fallback backend.
@@ -1094,7 +1119,7 @@ const Scene = function (containerIn, rendererIn) {
1094
1119
  */
1095
1120
  this.isWebGL2 = () => {
1096
1121
  return rendererIn?.backend?.isWebGLBackend === true;
1097
- }
1122
+ };
1098
1123
 
1099
1124
  /**
1100
1125
  * Check if the renderer is running on the WebGPU backend.
@@ -1103,7 +1128,7 @@ const Scene = function (containerIn, rendererIn) {
1103
1128
  */
1104
1129
  this.isWebGPU = () => {
1105
1130
  return rendererIn?.backend?.isWebGPUBackend === true;
1106
- }
1131
+ };
1107
1132
 
1108
1133
  /**
1109
1134
  * Get the THREE.WebGPURenderer this scene is being drawn with, for code
@@ -1113,7 +1138,7 @@ const Scene = function (containerIn, rendererIn) {
1113
1138
  */
1114
1139
  this.getRenderer = () => {
1115
1140
  return rendererIn;
1116
- }
1141
+ };
1117
1142
 
1118
1143
  /**
1119
1144
  * Remove all objects that are created with ZincJS APIs and it will free the memory allocated.
@@ -1130,60 +1155,60 @@ const Scene = function (containerIn, rendererIn) {
1130
1155
  zincCameraControls.calculateMaxAllowedDistance(this);
1131
1156
  }
1132
1157
  markerCluster.markerUpdateRequired = true;
1133
- }
1158
+ };
1134
1159
 
1135
1160
  /**
1136
1161
  * All time stamp to the metadata TimeStamps field.
1137
1162
  */
1138
1163
  this.addMetadataTimeStamp = (key, time) => {
1139
- metadata["TimeStamps"][key] = convertDurationObjectTomSec(time);
1140
- }
1164
+ metadata['TimeStamps'][key] = convertDurationObjectTomSec(time);
1165
+ };
1141
1166
 
1142
1167
  /**
1143
1168
  * Get a specific metadata field.
1144
1169
  */
1145
- this.getMetadataTag = key => {
1170
+ this.getMetadataTag = (key) => {
1146
1171
  return metadata[key];
1147
- }
1172
+ };
1148
1173
 
1149
1174
  /**
1150
1175
  * Get all metadata set for the scene.
1151
1176
  */
1152
1177
  this.getMetadata = () => {
1153
1178
  return metadata;
1154
- }
1179
+ };
1155
1180
 
1156
1181
  /**
1157
1182
  * Set a specific metadata field.
1158
1183
  */
1159
1184
  this.setMetadataTag = (key, value) => {
1160
1185
  metadata[key] = value;
1161
- }
1186
+ };
1162
1187
 
1163
1188
  /**
1164
1189
  * Remove a specific metadata field.
1165
1190
  */
1166
- this.removeMetadataTag = key => {
1191
+ this.removeMetadataTag = (key) => {
1167
1192
  delete metadata[key];
1168
- }
1193
+ };
1169
1194
 
1170
1195
  /**
1171
1196
  * Reset all metadata fields to original value.
1172
1197
  */
1173
1198
  this.resetMetadata = () => {
1174
1199
  metadata = defaultMetadata();
1175
- }
1200
+ };
1176
1201
 
1177
1202
  /**
1178
1203
  * Reset duration of scene to default value.
1179
1204
  */
1180
1205
  this.resetDuration = () => {
1181
1206
  this.setDuration(defaultDuration);
1182
- }
1207
+ };
1183
1208
 
1184
1209
  // Turn the object into a readable string {years: years,months: months,
1185
1210
  // weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
1186
- const convertDurationObjectToString = duration => {
1211
+ const convertDurationObjectToString = (duration) => {
1187
1212
  return [
1188
1213
  ...(duration.years ? [`${duration.years}years`] : []),
1189
1214
  ...(duration.months ? [`${duration.months}months`] : []),
@@ -1193,37 +1218,45 @@ const Scene = function (containerIn, rendererIn) {
1193
1218
  ...(duration.mins ? [`${duration.mins}mins`] : []),
1194
1219
  ...(duration.secs ? [`${duration.secs}secs`] : []),
1195
1220
  ].join(' ');
1196
- }
1221
+ };
1197
1222
 
1198
1223
  // Turn the object into a number representing milliesecond {years: years,months: months,
1199
1224
  // weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
1200
- const convertDurationObjectTomSec = duration => {
1201
- return duration.years ? duration.years * 31536000000 : 0 +
1202
- duration.months ? duration.months * 2592000000 : 0 +
1203
- duration.weeks ? duration.weeks * 604800000 : 0 +
1204
- duration.days ? duration.days * 86400000 : 0 +
1205
- duration.hours ? duration.hours * 3600000 : 0 +
1206
- duration.mins ? duration.mins * 60000 : 0 +
1207
- duration.secs ? duration.secs * 1000 : 0;
1208
- }
1225
+ const convertDurationObjectTomSec = (duration) => {
1226
+ return duration.years
1227
+ ? duration.years * 31536000000
1228
+ : 0 + duration.months
1229
+ ? duration.months * 2592000000
1230
+ : 0 + duration.weeks
1231
+ ? duration.weeks * 604800000
1232
+ : 0 + duration.days
1233
+ ? duration.days * 86400000
1234
+ : 0 + duration.hours
1235
+ ? duration.hours * 3600000
1236
+ : 0 + duration.mins
1237
+ ? duration.mins * 60000
1238
+ : 0 + duration.secs
1239
+ ? duration.secs * 1000
1240
+ : 0;
1241
+ };
1209
1242
 
1210
1243
  // Set the readable duration and timer using an object
1211
1244
  // with the following format {years: years,months: months, weeks: weeks, days: days,
1212
1245
  // hours: hours, mins: mins, secs: secs }
1213
- this.setDurationFromObject = duration => {
1246
+ this.setDurationFromObject = (duration) => {
1214
1247
  const string = convertDurationObjectToString(duration);
1215
1248
  const millisec = convertDurationObjectTomSec(duration);
1216
- this.setMetadataTag("Duration", string);
1249
+ this.setMetadataTag('Duration', string);
1217
1250
  this.setDuration(millisec);
1218
- }
1251
+ };
1219
1252
 
1220
1253
  // Set the readable original duration using an object
1221
1254
  // with the following format {years: years,months: months, weeks: weeks, days: days,
1222
1255
  // hours: hours, mins: mins, secs: secs }
1223
- this.setOriginalDurationFromObject = duration => {
1256
+ this.setOriginalDurationFromObject = (duration) => {
1224
1257
  const string = convertDurationObjectToString(duration);
1225
- this.setMetadataTag("OriginalDuration", string);
1226
- }
1258
+ this.setMetadataTag('OriginalDuration', string);
1259
+ };
1227
1260
 
1228
1261
  /**
1229
1262
  * Export the scene in GLTF format, it can either return it in
@@ -1237,7 +1270,7 @@ const Scene = function (containerIn, rendererIn) {
1237
1270
  this.exportGLTF = (binary) => {
1238
1271
  const exporter = new SceneExporter(this);
1239
1272
  return exporter.exportGLTF(binary);
1240
- }
1273
+ };
1241
1274
 
1242
1275
  /**
1243
1276
  * Get the root region of the scene.
@@ -1246,118 +1279,118 @@ const Scene = function (containerIn, rendererIn) {
1246
1279
  */
1247
1280
  this.getRootRegion = () => {
1248
1281
  return rootRegion;
1249
- }
1282
+ };
1250
1283
 
1251
1284
  /**
1252
1285
  * Create points in region specified in the path
1253
1286
  *
1254
1287
  */
1255
- this.createLines = ( regionPath, groupName, coords, colour ) => {
1288
+ this.createLines = (regionPath, groupName, coords, colour) => {
1256
1289
  let region = rootRegion.findChildFromPath(regionPath);
1257
1290
  if (region === undefined) {
1258
1291
  region = rootRegion.createChildFromPath(regionPath);
1259
1292
  }
1260
1293
  return region.createLines(groupName, coords, colour);
1261
- }
1294
+ };
1262
1295
 
1263
1296
  /**
1264
1297
  * Create points in region specified in the path
1265
1298
  *
1266
1299
  */
1267
- this.createPoints = ( regionPath, groupName, coords, labels, colour ) => {
1300
+ this.createPoints = (regionPath, groupName, coords, labels, colour) => {
1268
1301
  let region = rootRegion.findChildFromPath(regionPath);
1269
1302
  if (region === undefined) {
1270
1303
  region = rootRegion.createChildFromPath(regionPath);
1271
1304
  }
1272
1305
  return region.createPoints(groupName, coords, labels, colour);
1273
- }
1274
-
1275
- /**
1276
- * Add a callback function which will be called everytime zinc object is added.
1277
- * @param {Function} callbackFunction - callbackFunction to be added.
1278
- *
1279
- * @return {Number}
1280
- */
1281
- this.addZincObjectAddedCallbacks = callbackFunction => {
1282
- zincObjectAddedCallbacks_id = zincObjectAddedCallbacks_id + 1;
1283
- zincObjectAddedCallbacks[zincObjectAddedCallbacks_id] = callbackFunction;
1284
- return zincObjectAddedCallbacks_id;
1285
- }
1286
-
1287
- /**
1288
- * Add a callback function which will be called everytime zinc object is removed.
1289
- * @param {Function} callbackFunction - callbackFunction to be added.
1290
- *
1291
- * @return {Number}
1292
- */
1293
- this.addZincObjectRemovedCallbacks = callbackFunction => {
1294
- zincObjectRemovedCallbacks_id = zincObjectRemovedCallbacks_id + 1;
1295
- zincObjectRemovedCallbacks[zincObjectRemovedCallbacks_id] = callbackFunction;
1296
- return zincObjectRemovedCallbacks_id;
1297
- }
1298
-
1299
- /**
1300
- * Remove a callback function that is previously added to the scene.
1301
- * @param {Number} id - identifier of the previously added callback function.
1302
- */
1303
- this.removeZincObjectAddedCallbacks = id => {
1304
- if (id in zincObjectAddedCallbacks_id) {
1305
- delete zincObjectAddedCallbacks[id];
1306
- }
1307
- }
1308
-
1309
- /**
1310
- * Remove a callback function that is previously added to the scene.
1311
- * @param {Number} id - identifier of the previously added callback function.
1312
- */
1313
- this.removeZincObjectRemovedCallbacks = id => {
1314
- if (id in zincObjectRemovedCallbacks_id) {
1315
- delete zincObjectRemovedCallbacks[id];
1316
- }
1317
- }
1318
-
1319
- /**
1320
- * Clear all zinc object callback function
1321
- */
1322
- this.clearZincObjectAddedCallbacks = () => {
1323
- zincObjectAddedCallbacks = {};
1306
+ };
1307
+
1308
+ /**
1309
+ * Add a callback function which will be called everytime zinc object is added.
1310
+ * @param {Function} callbackFunction - callbackFunction to be added.
1311
+ *
1312
+ * @return {Number}
1313
+ */
1314
+ this.addZincObjectAddedCallbacks = (callbackFunction) => {
1315
+ zincObjectAddedCallbacks_id = zincObjectAddedCallbacks_id + 1;
1316
+ zincObjectAddedCallbacks[zincObjectAddedCallbacks_id] = callbackFunction;
1317
+ return zincObjectAddedCallbacks_id;
1318
+ };
1319
+
1320
+ /**
1321
+ * Add a callback function which will be called everytime zinc object is removed.
1322
+ * @param {Function} callbackFunction - callbackFunction to be added.
1323
+ *
1324
+ * @return {Number}
1325
+ */
1326
+ this.addZincObjectRemovedCallbacks = (callbackFunction) => {
1327
+ zincObjectRemovedCallbacks_id = zincObjectRemovedCallbacks_id + 1;
1328
+ zincObjectRemovedCallbacks[zincObjectRemovedCallbacks_id] = callbackFunction;
1329
+ return zincObjectRemovedCallbacks_id;
1330
+ };
1331
+
1332
+ /**
1333
+ * Remove a callback function that is previously added to the scene.
1334
+ * @param {Number} id - identifier of the previously added callback function.
1335
+ */
1336
+ this.removeZincObjectAddedCallbacks = (id) => {
1337
+ if (id in zincObjectAddedCallbacks_id) {
1338
+ delete zincObjectAddedCallbacks[id];
1339
+ }
1340
+ };
1341
+
1342
+ /**
1343
+ * Remove a callback function that is previously added to the scene.
1344
+ * @param {Number} id - identifier of the previously added callback function.
1345
+ */
1346
+ this.removeZincObjectRemovedCallbacks = (id) => {
1347
+ if (id in zincObjectRemovedCallbacks_id) {
1348
+ delete zincObjectRemovedCallbacks[id];
1349
+ }
1350
+ };
1351
+
1352
+ /**
1353
+ * Clear all zinc object callback function
1354
+ */
1355
+ this.clearZincObjectAddedCallbacks = () => {
1356
+ zincObjectAddedCallbacks = {};
1324
1357
  zincObjectAddedCallbacks_id = 0;
1325
- }
1358
+ };
1326
1359
 
1327
1360
  /**
1328
- * Clear all zinc object callback function
1329
- */
1330
- this.clearZincObjectRemovedCallbacks = () => {
1331
- zincObjectRemovedCallbacks = {};
1361
+ * Clear all zinc object callback function
1362
+ */
1363
+ this.clearZincObjectRemovedCallbacks = () => {
1364
+ zincObjectRemovedCallbacks = {};
1332
1365
  zincObjectRemovedCallbacks_id = 0;
1333
- }
1366
+ };
1334
1367
 
1335
1368
  /**
1336
- * Used to trigger zinc object added callback
1337
- */
1369
+ * Used to trigger zinc object added callback
1370
+ */
1338
1371
  this.triggerObjectAddedCallback = (zincObject) => {
1339
1372
  for (let key in zincObjectAddedCallbacks) {
1340
1373
  if (zincObjectAddedCallbacks.hasOwnProperty(key)) {
1341
1374
  zincObjectAddedCallbacks[key](zincObject);
1342
1375
  }
1343
1376
  }
1344
- }
1377
+ };
1345
1378
 
1346
1379
  /**
1347
- * Used to trigger zinc object removed callback
1348
- */
1349
- this.triggerObjectRemovedCallback= (zincObject) => {
1380
+ * Used to trigger zinc object removed callback
1381
+ */
1382
+ this.triggerObjectRemovedCallback = (zincObject) => {
1350
1383
  for (let key in zincObjectRemovedCallbacks) {
1351
1384
  if (zincObjectRemovedCallbacks.hasOwnProperty(key)) {
1352
1385
  zincObjectRemovedCallbacks[key](zincObject);
1353
1386
  }
1354
1387
  }
1355
- }
1388
+ };
1356
1389
 
1357
1390
  /*
1358
- * Add temporary points to the scene which can be removed
1391
+ * Add temporary points to the scene which can be removed
1359
1392
  * with clearTemporaryPrimitives method.
1360
- */
1393
+ */
1361
1394
  this.addTemporaryPoints = (coords, colour) => {
1362
1395
  needsRender = true;
1363
1396
  const geometry = createPointQuadGeometry(coords.length);
@@ -1376,36 +1409,35 @@ const Scene = function (containerIn, rendererIn) {
1376
1409
  instancePosition.needsUpdate = true;
1377
1410
  tempGroup.add(point);
1378
1411
  return point;
1379
- }
1412
+ };
1380
1413
 
1381
1414
  /*
1382
- * Add temporary lines to the scene which can be removed
1415
+ * Add temporary lines to the scene which can be removed
1383
1416
  * with clearTemporaryPrimitives method.
1384
- */
1417
+ */
1385
1418
  this.addTemporaryLines = (coords, colour) => {
1386
1419
  needsRender = true;
1387
1420
  const geometry = createBufferGeometry(coords.length, coords);
1388
- const material = new THREE.LineBasicMaterial({color:colour});
1421
+ const material = new THREE.LineBasicMaterial({ color: colour });
1389
1422
  const line = new LineSegments(geometry, material);
1390
1423
  tempGroup.add(line);
1391
1424
  return line;
1392
- }
1393
-
1425
+ };
1394
1426
 
1395
1427
  /*
1396
- * Display frustum
1397
- */
1428
+ * Display frustum
1429
+ */
1398
1430
  this.enableFrustumDisplay = () => {
1399
1431
  needsRender = true;
1400
1432
  if (this.camera && !cameraHelper) {
1401
1433
  cameraHelper = new THREE.CameraHelper(this.camera);
1402
1434
  scene.add(cameraHelper);
1403
1435
  }
1404
- }
1436
+ };
1405
1437
 
1406
1438
  /*
1407
- * Hide frustum
1408
- */
1439
+ * Hide frustum
1440
+ */
1409
1441
  this.disableFrustumDisplay = () => {
1410
1442
  needsRender = true;
1411
1443
  if (cameraHelper) {
@@ -1413,41 +1445,47 @@ const Scene = function (containerIn, rendererIn) {
1413
1445
  cameraHelper.dispose();
1414
1446
  cameraHelper = undefined;
1415
1447
  }
1416
- }
1448
+ };
1417
1449
 
1418
1450
  /*
1419
- * Remove object from temporary objects list
1420
- */
1451
+ * Remove object from temporary objects list
1452
+ */
1421
1453
  this.removeTemporaryPrimitive = (object) => {
1422
1454
  needsRender = true;
1423
1455
  tempGroup.remove(object);
1424
1456
  object.geometry.dispose();
1425
1457
  object.material.dispose();
1426
- }
1458
+ };
1427
1459
 
1428
1460
  /*
1429
- * Remove all temporary primitives.
1461
+ * Remove all temporary primitives.
1430
1462
  * Return number of primitives removed;
1431
- */
1463
+ */
1432
1464
  this.clearTemporaryPrimitives = () => {
1433
1465
  needsRender = true;
1434
1466
  let i = 0;
1435
1467
  const children = tempGroup.children;
1436
- children.forEach(child => {
1468
+ children.forEach((child) => {
1437
1469
  child.geometry.dispose();
1438
1470
  child.material.dispose();
1439
1471
  i++;
1440
1472
  });
1441
1473
  tempGroup.clear();
1442
1474
  return i;
1443
- }
1475
+ };
1444
1476
 
1445
1477
  /*
1446
- * Create primitive based on the bounding box of scene and
1478
+ * Create primitive based on the bounding box of scene and
1447
1479
  * add to specify region and group name.
1448
- */
1449
- this.addBoundingBoxPrimitive = (regionPath, group, colour, opacity,
1450
- visibility, boundingBox = undefined) => {
1480
+ */
1481
+ this.addBoundingBoxPrimitive = (
1482
+ regionPath,
1483
+ group,
1484
+ colour,
1485
+ opacity,
1486
+ visibility,
1487
+ boundingBox = undefined,
1488
+ ) => {
1451
1489
  needsRender = true;
1452
1490
  let region = rootRegion.findChildFromPath(regionPath);
1453
1491
  if (region === undefined) {
@@ -1458,21 +1496,32 @@ const Scene = function (containerIn, rendererIn) {
1458
1496
  const dim = _v3.subVectors(box.max, box.min);
1459
1497
  const boxGeo = new THREE.BoxGeometry(dim.x, dim.y, dim.z);
1460
1498
  const primitive = region.createGeometryFromThreeJSGeometry(
1461
- group, boxGeo, colour, opacity, visibility, 10000);
1462
- dim.addVectors(box.min, box.max).multiplyScalar( 0.5 );
1499
+ group,
1500
+ boxGeo,
1501
+ colour,
1502
+ opacity,
1503
+ visibility,
1504
+ 10000,
1505
+ );
1506
+ dim.addVectors(box.min, box.max).multiplyScalar(0.5);
1463
1507
  primitive.setPosition(dim.x, dim.y, dim.z);
1464
1508
  return primitive;
1465
- }
1509
+ };
1466
1510
 
1467
1511
  /*
1468
- * Create primitive based on the bounding box of scene and
1512
+ * Create primitive based on the bounding box of scene and
1469
1513
  * add to specify region and group name.
1470
- */
1471
- this.addSlicesPrimitive = (regionPath, groups, colours, opacity,
1472
- visibility, boundingBox = undefined) => {
1514
+ */
1515
+ this.addSlicesPrimitive = (
1516
+ regionPath,
1517
+ groups,
1518
+ colours,
1519
+ opacity,
1520
+ visibility,
1521
+ boundingBox = undefined,
1522
+ ) => {
1473
1523
  needsRender = true;
1474
- if (groups && groups.length >= 3 &&
1475
- colours && colours.length >= 3) {
1524
+ if (groups && groups.length >= 3 && colours && colours.length >= 3) {
1476
1525
  let region = rootRegion.findChildFromPath(regionPath);
1477
1526
  if (region === undefined) {
1478
1527
  region = rootRegion.createChildFromPath(regionPath);
@@ -1480,49 +1529,55 @@ const Scene = function (containerIn, rendererIn) {
1480
1529
  const box = boundingBox ? boundingBox : this.getBoundingBox();
1481
1530
  _v3.set(0.0, 0.0, 0.0);
1482
1531
  const dim = _v3.subVectors(box.max, box.min);
1483
- const directions = ["x", "y", "z"];
1532
+ const directions = ['x', 'y', 'z'];
1484
1533
  const primitives = [];
1485
1534
  let index = 0;
1486
1535
  directions.forEach((direction) => {
1487
1536
  let planeGeo = undefined;
1488
- switch(direction) {
1537
+ switch (direction) {
1489
1538
  //YZ plane
1490
- case "x":
1539
+ case 'x':
1491
1540
  planeGeo = new THREE.PlaneGeometry(dim.z, dim.y);
1492
1541
  planeGeo.rotateY(Math.PI / 2);
1493
1542
  // code block
1494
1543
  break;
1495
1544
  //XZ plane
1496
- case "y":
1545
+ case 'y':
1497
1546
  planeGeo = new THREE.PlaneGeometry(dim.x, dim.z);
1498
1547
  planeGeo.rotateX(Math.PI / 2);
1499
1548
  // code block
1500
1549
  break;
1501
1550
  //XY plane
1502
- case "z":
1551
+ case 'z':
1503
1552
  planeGeo = new THREE.PlaneGeometry(dim.x, dim.y);
1504
- // code block
1553
+ // code block
1505
1554
  break;
1506
1555
  default:
1507
1556
  break;
1508
1557
  }
1509
1558
  const primitive = region.createGeometryFromThreeJSGeometry(
1510
- groups[index], planeGeo, colours[index], opacity, visibility, 10001);
1559
+ groups[index],
1560
+ planeGeo,
1561
+ colours[index],
1562
+ opacity,
1563
+ visibility,
1564
+ 10001,
1565
+ );
1511
1566
  primitives.push(primitive);
1512
1567
  index++;
1513
1568
  });
1514
1569
 
1515
- dim.addVectors(box.min, box.max).multiplyScalar( 0.5 );
1570
+ dim.addVectors(box.min, box.max).multiplyScalar(0.5);
1516
1571
  primitives.forEach((primitive) => {
1517
1572
  primitive.setPosition(dim.x, dim.y, dim.z);
1518
1573
  });
1519
1574
  return primitives;
1520
1575
  }
1521
- }
1576
+ };
1522
1577
 
1523
1578
  /*
1524
- * Enable marker cluster to work with markers
1525
- */
1579
+ * Enable marker cluster to work with markers
1580
+ */
1526
1581
  this.enableMarkerCluster = (flag) => {
1527
1582
  needsRender = true;
1528
1583
  if (flag) {
@@ -1533,17 +1588,17 @@ const Scene = function (containerIn, rendererIn) {
1533
1588
  markerCluster.disable();
1534
1589
  }
1535
1590
  this.forcePickableObjectsUpdate = true;
1536
- }
1591
+ };
1537
1592
 
1538
1593
  /*
1539
- * Destory static axis display object
1540
- */
1594
+ * Destory static axis display object
1595
+ */
1541
1596
  this.destroyAxisDisplay = () => {
1542
1597
  needsRender = true;
1543
1598
  this.displayMiniAxes = false;
1544
1599
  if (axisDisplay.main) {
1545
1600
  this.enableAxisDisplay(false, false);
1546
- axisDisplay.main.forEach(axis => {
1601
+ axisDisplay.main.forEach((axis) => {
1547
1602
  if (axis.dispose) {
1548
1603
  axis.dispose();
1549
1604
  }
@@ -1551,7 +1606,7 @@ const Scene = function (containerIn, rendererIn) {
1551
1606
  }
1552
1607
  if (axisDisplay.mini) {
1553
1608
  this.enableAxisDisplay(false, true);
1554
- axisDisplay.mini.forEach(axis => {
1609
+ axisDisplay.mini.forEach((axis) => {
1555
1610
  if (axis.dispose) {
1556
1611
  axis.dispose();
1557
1612
  }
@@ -1561,33 +1616,33 @@ const Scene = function (containerIn, rendererIn) {
1561
1616
  main: [],
1562
1617
  mini: [],
1563
1618
  };
1564
- }
1619
+ };
1565
1620
 
1566
1621
  /*
1567
- * Create static axis display object
1568
- */
1622
+ * Create static axis display object
1623
+ */
1569
1624
  this.createAxisDisplay = (fitBoundingBox = false) => {
1570
1625
  needsRender = true;
1571
1626
  this.destroyAxisDisplay();
1572
1627
  const XYZ = [
1573
1628
  {
1574
- name: "x",
1629
+ name: 'x',
1575
1630
  dir: new THREE.Vector3(1, 0, 0),
1576
- colour: "red",
1577
- hex: 0xFF5555
1631
+ colour: 'red',
1632
+ hex: 0xff5555,
1578
1633
  },
1579
1634
  {
1580
- name: "y",
1635
+ name: 'y',
1581
1636
  dir: new THREE.Vector3(0, 1, 0),
1582
- colour: "green",
1583
- hex: 0x55FF55
1637
+ colour: 'green',
1638
+ hex: 0x55ff55,
1584
1639
  },
1585
1640
  {
1586
- name: "z",
1641
+ name: 'z',
1587
1642
  dir: new THREE.Vector3(0, 0, 1),
1588
- colour: "blue",
1589
- hex: 0x5555FF
1590
- }
1643
+ colour: 'blue',
1644
+ hex: 0x5555ff,
1645
+ },
1591
1646
  ];
1592
1647
  const boundingBox = this.getBoundingBox();
1593
1648
  const size = boundingBox.min.distanceTo(boundingBox.max);
@@ -1598,7 +1653,12 @@ const Scene = function (containerIn, rendererIn) {
1598
1653
  XYZ.forEach((xyzObj) => {
1599
1654
  const arrowHelper = new THREE.ArrowHelper(xyzObj.dir, origin, size, xyzObj.hex);
1600
1655
  axisDisplay.main.push(arrowHelper);
1601
- const miniArrowHelper = new THREE.ArrowHelper(xyzObj.dir, boundingBox.getCenter(_v3), size / 2, xyzObj.hex);
1656
+ const miniArrowHelper = new THREE.ArrowHelper(
1657
+ xyzObj.dir,
1658
+ boundingBox.getCenter(_v3),
1659
+ size / 2,
1660
+ xyzObj.hex,
1661
+ );
1602
1662
  axisDisplay.mini.push(miniArrowHelper);
1603
1663
 
1604
1664
  /*
@@ -1608,30 +1668,30 @@ const Scene = function (containerIn, rendererIn) {
1608
1668
  axisDisplay.mini.push(miniLabel);
1609
1669
  */
1610
1670
 
1611
- const axesLabel = createNewSpriteText(xyzObj.name, 0.036, xyzObj.colour, "Asap", 120, 700);
1671
+ const axesLabel = createNewSpriteText(xyzObj.name, 0.036, xyzObj.colour, 'Asap', 120, 700);
1612
1672
  const position = xyzObj.dir.clone().multiplyScalar(size).add(origin);
1613
1673
  axesLabel.position.set(position.x, position.y, position.z);
1614
1674
  axisDisplay.main.push(axesLabel);
1615
- })
1616
- }
1675
+ });
1676
+ };
1617
1677
 
1618
1678
  /*
1619
- * Enable static axis display, createAxisDisplay must be called
1679
+ * Enable static axis display, createAxisDisplay must be called
1620
1680
  * before the axis can be display.
1621
- */
1681
+ */
1622
1682
  this.enableAxisDisplay = (enable, miniaxes = false) => {
1623
1683
  needsRender = true;
1624
1684
  if (miniaxes && axisDisplay?.mini?.length) {
1625
1685
  this.displayMiniAxes = enable;
1626
- axisDisplay.mini.forEach(axis => {
1686
+ axisDisplay.mini.forEach((axis) => {
1627
1687
  enable ? miniAxesScene.add(axis) : miniAxesScene.remove(axis);
1628
1688
  });
1629
1689
  } else if (!miniaxes && axisDisplay.main) {
1630
- axisDisplay.main.forEach(axis => {
1690
+ axisDisplay.main.forEach((axis) => {
1631
1691
  enable ? scene.add(axis) : scene.remove(axis);
1632
1692
  });
1633
1693
  }
1634
- }
1635
- }
1694
+ };
1695
+ };
1636
1696
 
1637
1697
  export { Scene };