zincjs 1.16.1 → 1.16.3

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/build/zinc.js CHANGED
@@ -32,7 +32,7 @@ module.exports = require("url-polyfill");
32
32
  /***/ ((module) => {
33
33
 
34
34
  "use strict";
35
- module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.16.1","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
35
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.16.3","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
36
36
 
37
37
  /***/ }),
38
38
  /* 3 */
@@ -269,7 +269,7 @@ var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).cr
269
269
  /**
270
270
  * Groupname given to this geometry.
271
271
  */ /**
272
- * Total duration of the animation, this value interacts with the
272
+ * Total duration of the animation, this value interacts with the
273
273
  * {@link Renderer#playRate} to produce the actual duration of the
274
274
  * animation. Actual time in second = duration / playRate.
275
275
  */ //Draw range is only used by primitives added
@@ -278,17 +278,17 @@ var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).cr
278
278
  this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new((__webpack_require__(11).LOD))(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId(),this._v1=new THREE.Vector3,this._v2=new THREE.Vector3,this._b1=new THREE.Box3,this.center=new THREE.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};/**
279
279
  * Provides the base object for other primitive types.
280
280
  * This class contains multiple base methods.
281
- *
281
+ *
282
282
  * @class
283
283
  * @author Alan Wu
284
284
  * @return {ZincObject}
285
285
  */ /**
286
286
  * Set the duration of the animation of this object.
287
- *
287
+ *
288
288
  * @param {Number} durationIn - Duration of the animation.
289
289
  */ /**
290
290
  * Get the duration of the animation of this object.
291
- *
291
+ *
292
292
  * @return {Number}
293
293
  */ /**
294
294
  * Set the region this object belongs to.
@@ -296,24 +296,24 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
296
296
  * @param {Region} region
297
297
  */ /**
298
298
  * Get the region this object belongs to.
299
- *
299
+ *
300
300
  * @return {Region}
301
301
  */ /**
302
- * Get the threejs object3D.
303
- *
302
+ * Get the threejs object3D.
303
+ *
304
304
  * @return {Object}
305
305
  */ /**
306
- * Get the threejs object3D.
307
- *
306
+ * Get the threejs object3D.
307
+ *
308
308
  * @return {Object}
309
309
  */ /**
310
- * Set the internal threejs object3D.
310
+ * Set the internal threejs object3D.
311
311
  */ /**
312
312
  * Handle transparent mesh, create a clone for backside rendering if it is
313
313
  * transparent.
314
314
  */ /**
315
315
  * Set the mesh function for zincObject.
316
- *
316
+ *
317
317
  * @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
318
318
  * @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
319
319
  * time dependent.
@@ -321,105 +321,105 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
321
321
  * time dependent.
322
322
  */ /**
323
323
  * Set isPickable for this ZincObject.
324
- *
324
+ *
325
325
  * @param {String} isPickable - Boolean to enable object pick.
326
326
  */ /**
327
327
  * Set the anatomicalId for this ZincObject.
328
- *
328
+ *
329
329
  * @param {String} anatomicalId - Id to be set.
330
330
  */ /**
331
331
  * Set the name for this ZincObject.
332
- *
332
+ *
333
333
  * @param {String} groupNameIn - Name to be set.
334
334
  */ /**
335
- * Get the local time of this geometry, it returns a value between
335
+ * Get the local time of this geometry, it returns a value between
336
336
  * 0 and the duration.
337
- *
337
+ *
338
338
  * @return {Number}
339
339
  */ /**
340
340
  * Set the local time of this geometry.
341
- *
341
+ *
342
342
  * @param {Number} time - Can be any value between 0 to duration.
343
343
  */ /**
344
344
  * Check if the geometry is time varying.
345
- *
345
+ *
346
346
  * @return {Boolean}
347
347
  */ /**
348
348
  * Get the visibility of this Geometry.
349
- *
349
+ *
350
350
  */ /**
351
351
  * Set the visibility of this Geometry.
352
- *
353
- * @param {Boolean} visible - a boolean flag indicate the visibility to be set
352
+ *
353
+ * @param {Boolean} visible - a boolean flag indicate the visibility to be set
354
354
  */ /**
355
355
  * Set the opacity of this Geometry. This function will also set the isTransparent
356
356
  * flag according to the provided alpha value.
357
- *
358
- * @param {Number} alpah - Alpha value to set for this geometry,
357
+ *
358
+ * @param {Number} alpah - Alpha value to set for this geometry,
359
359
  * can be any value between from 0 to 1.0.
360
360
  */ /**
361
361
  * The rendering will be culled if it is outside of the frustrum
362
362
  * when this flag is set to true, it should be set to false if
363
363
  * morphing is enabled.
364
- *
364
+ *
365
365
  * @param {Boolean} flag - Set frustrum culling on/off based on this flag.
366
366
  */ /**
367
367
  * Set rather a zinc object should be displayed using per vertex colour or
368
368
  * not.
369
- *
369
+ *
370
370
  * @param {Boolean} vertexColors - Set display with vertex color on/off.
371
371
  */ /**
372
372
  * Get the colour of the mesh.
373
- *
373
+ *
374
374
  * @return {THREE.Color}
375
375
  */ /**
376
376
  * Set the colour of the mesh.
377
- *
377
+ *
378
378
  * @param {THREE.Color} colour - Colour to be set for this geometry.
379
379
  */ /**
380
380
  * Set the colour of the mesh.
381
- *
381
+ *
382
382
  * @param {THREE.Color} colour - Colour to be set for this geometry.
383
383
  */ /**
384
384
  * Get the colour of the mesh in hex string form.
385
- *
385
+ *
386
386
  * @return {String}
387
387
  */ /**
388
388
  * Set the colour of the mesh using hex in string form.
389
- *
389
+ *
390
390
  * @param {String} hex - The colour value in hex form.
391
391
  */ /**
392
392
  * Set the emissive rgb of the mesh using rgb.
393
- *
393
+ *
394
394
  * @param {String} colour - The colour value in rgb form.
395
395
  */ /**
396
396
  * Set the material of the geometry.
397
- *
397
+ *
398
398
  * @param {THREE.Material} material - Material to be set for this geometry.
399
399
  */ /**
400
400
  * Get the index of the closest vertex to centroid.
401
- *
401
+ *
402
402
  * @return {Number} - integer index in the array
403
403
  */ /**
404
404
  * Get the closest vertex to centroid.
405
- *
405
+ *
406
406
  * @return {THREE.Vector3}
407
407
  */ /**
408
408
  * Get the bounding box of this geometry.
409
- *
409
+ *
410
410
  * @return {THREE.Box3}.
411
411
  */ /**
412
412
  * Clear this geometry and free the memory.
413
413
  */ /**
414
- * Check if marker is enabled based on the objects settings with
414
+ * Check if marker is enabled based on the objects settings with
415
415
  * the provided scene options.
416
- *
417
- * @return {Boolean}
416
+ *
417
+ * @return {Boolean}
418
418
  */ /**
419
- * Update the marker's position and size based on current viewport.
419
+ * Update the marker's position and size based on current viewport.
420
420
  */ /**
421
421
  * Get the windows coordinates.
422
- *
422
+ *
423
423
  * @return {Object} - position and rather the closest vertex is on screen.
424
424
  */ /**
425
425
  * Set marker mode for this zinc object which determine rather the
@@ -430,8 +430,8 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
430
430
  * "off" - marker is disabled regardless of settings of scene
431
431
  * "inherited" - Marker settings on scene will determine the visibility
432
432
  * of the marker.
433
- *
434
- * @return {Boolean}
433
+ *
434
+ * @return {Boolean}
435
435
  */ //Update the geometry and colours depending on the morph.
436
436
  /**
437
437
  * Add lod from an url into the lod object.
@@ -444,10 +444,11 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
444
444
  */ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region},ZincObject.prototype.getMorph=function(){var morph=this._lod.getCurrentMorph();return morph?morph:this.morph},ZincObject.prototype.getGroup=function(){return this.group},ZincObject.prototype.setMorph=function(mesh){this.morph=mesh,this.group.add(this.morph);//this is the base level object
445
445
  var distance=this._lod.calculateDistance("far");this._lod.addLevel(mesh,distance),this._lod.setMaterial(mesh.material)},ZincObject.prototype.checkTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup);var geometry=mesh.geometry;if(this.geometry=mesh.geometry,this.clipAction=void 0,geometry&&geometry.morphAttributes){var morphAttribute=geometry.morphAttributes.position;morphAttribute||(morphAttribute=geometry.morphAttributes.color?geometry.morphAttributes.color:geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,mesh.userData=this,mesh.matrixAutoUpdate=!1,this.setMorph(mesh),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setIsPickable=function(isPickable){this.isPickable!==isPickable&&(this.isPickable=isPickable,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAnatomicalId=function(anatomicalId){this.anatomicalId=anatomicalId},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this._lod.setName(groupNameIn)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return this.visible},ZincObject.prototype.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0),material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh()},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
446
446
  this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(vertexColors){//multilayers - set for all
447
- this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.geoemtry){var position=morph.geometry.attributes.position;if(this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1),position)for(var distance=-1,currentDistance=0,i=0;i<position.count;i++)this._v2.fromArray(position.array,3*i),currentDistance=this._v2.distanceTo(this._v1),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var morph=this.getMorph();if(morph&&morph.geometry&&0<=this.closestVertexIndex){var influences=morph.morphTargetInfluences,attributes=morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._v1.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._v1.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}else return position.fromArray(morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}return this.getBoundingBox(),position.copy(this.center),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){if(this.visible){var morph=this._lod.getCurrentMorph();if(morph&&morph.visible)return this.boundingBoxUpdateRequired&&((__webpack_require__(5).getBoundingBox)(morph,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){//multilayyers
447
+ this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.geometry){var position=morph.geometry.attributes.position;if(position){this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1);for(var distance=-1,currentDistance=0,i=0;i<position.count;i++)this._v2.fromArray(position.array,3*i),currentDistance=this._v2.distanceTo(this._v1),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var morph=this.getMorph();if(morph&&morph.geometry&&0<=this.closestVertexIndex){var influences=morph.morphTargetInfluences,attributes=morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._v1.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._v1.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}else return position.fromArray(morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}//Matrix world has already been applied
448
+ return this.getBoundingBox(),position.copy(this.center),position},ZincObject.prototype.getBoundingBox=function(){if(this.visible){var morph=this._lod.getCurrentMorph();if(morph&&morph.visible)return this.boundingBoxUpdateRequired&&((__webpack_require__(5).getBoundingBox)(morph,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){//multilayyers
448
449
  this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsRequired=function(options){return!!(this.visible&&("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode))},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!1==playAnimation&&this.markerIsRequired(options)){var ndcToBeUpdated=options.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new((__webpack_require__(14).Marker))(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var position=this.getClosestVertex(!1);position&&(this.marker.setPosition(position.x,position.y,position.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(options.markersList&&!(this.marker.uuid in options.markersList)&&(ndcToBeUpdated=!0,options.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),options&&options.camera&&(ndcToBeUpdated||options.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(options.camera.cameraObject),options.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),options.markersList&&this.marker.uuid in options.markersList&&(options.markerCluster.markerUpdateRequired=!0,delete options.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},ZincObject.prototype.setRenderOrder=function(renderOrder){//multiilayers
449
450
  this._lod.setRenderOrder(renderOrder)},ZincObject.prototype.getClosestVertexDOMElementCoords=function(scene){if(scene&&scene.camera){var inView=!0,position=this.getClosestVertex(!0);return position.project(scene.camera),position.z=Math.min(Math.max(position.z,0),1),(1<position.x||-1>position.x||1<position.y||-1>position.y)&&(inView=!1),scene.getZincCameraControls().getRelativeCoordsFromNDC(position.x,position.y,position),{position,inView}}},ZincObject.prototype.setMarkerMode=function(mode,options){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),options&&(this.markerNumber=options.number,this.markerImgURL=options.imgURL)},ZincObject.prototype.render=function(delta,playAnimation,cameraControls,options){if(this.visible&&!(this.timeEnabled&&playAnimation)&&this._lod.update(cameraControls,this.center),!0==playAnimation){if(this.clipAction&&this.isTimeVarying())this.mixer.update(delta);else{var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime}//multilayers
450
- this.visible&&0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(playAnimation,options)},ZincObject.prototype.addLOD=function(loader,level,url,index,preload){this._lod.addLevelFromURL(loader,level,url,index,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(500,coords),this.drawRange=coords.length;else if(-1<this.drawRange){var positionAttribute=mesh.geometry.getAttribute("position");coords.forEach(coord=>{positionAttribute.setXYZ(this.drawRange,coord[0],coord[1],coord[2]),++this.drawRange}),positionAttribute.needsUpdate=!0,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),geometry=mesh.geoemtry,this.boundingBoxUpdateRequired=!0}return geometry},ZincObject.prototype.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},ZincObject.prototype.loadAdditionalSources=function(primitivesLoader){primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},ZincObject.prototype.setScaleAll=function(scale){var group=this.getGroup();group&&(group.scale.set(scale,scale,scale),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},exports.ZincObject=ZincObject;
451
+ this.visible&&0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(playAnimation,options)},ZincObject.prototype.addLOD=function(loader,level,url,index,preload){this._lod.addLevelFromURL(loader,level,url,index,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(500,coords),this.drawRange=coords.length;else if(-1<this.drawRange){var positionAttribute=mesh.geometry.getAttribute("position");coords.forEach(coord=>{positionAttribute.setXYZ(this.drawRange,coord[0],coord[1],coord[2]),++this.drawRange}),positionAttribute.needsUpdate=!0,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),geometry=mesh.geoemtry,this.boundingBoxUpdateRequired=!0}return geometry},ZincObject.prototype.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.matrixWorldNeedsUpdate=!0,group.updateMatrix(),group.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},ZincObject.prototype.loadAdditionalSources=function(primitivesLoader){primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},ZincObject.prototype.setScaleAll=function(scale){var group=this.getGroup();group&&(group.scale.set(scale,scale,scale),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},exports.ZincObject=ZincObject;
451
452
 
452
453
  /***/ }),
453
454
  /* 11 */
@@ -982,12 +983,12 @@ function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var
982
983
  direction the slide should be facing.
983
984
  @property {Number} value - Normalised value of the location on direction.
984
985
  @property {String} id - ID of the mesh, it is only available if the settings
985
- is returned from {@link TextureSlides.createSlide} or
986
+ is returned from {@link TextureSlides.createSlide} or
986
987
  {@link TextureSlides.getTextureSettings}.
987
988
  */ /**
988
989
  * Create the slides required for visualisation based on the slide settings.
989
990
  * The slides themselves are {THREE.PlanGeometry} objects.
990
- *
991
+ *
991
992
  * @param {SLIDE_SETTINGS} slideSettings - An array to each slide settings.
992
993
  */this.createSlides=slideSettings=>{slideSettings.forEach(slide=>this.createSlide(slide))};/**
993
994
  * Set the value of the uniforms for a specific mesh in this
@@ -1004,16 +1005,16 @@ var expandBoxWithSettings=(box,settings,vector)=>{if(settings)switch(settings.di
1004
1005
  * Get the bounding box of this slides.
1005
1006
  * It uses the max and min of the slides position and the
1006
1007
  * transformation to calculate the position of the box.
1007
- *
1008
+ *
1008
1009
  * @return {THREE.Box3}.
1009
1010
  */this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var vector=new THREE.Vector3(0,0,0);this.morph.children.forEach(slide=>{expandBoxWithSettings(this.cachedBoundingBox,slide.material.uniforms,vector)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(rotation,position,scale)=>{var matrix=new THREE.Matrix4;matrix.set(rotation[0],rotation[1],rotation[2],0,rotation[3],rotation[4],rotation[5],0,rotation[6],rotation[7],rotation[8],0,0,0,0,0);var quaternion=new THREE.Quaternion().setFromRotationMatrix(matrix);this.morph.position.set(...position),this.morph.quaternion.copy(quaternion),this.morph.scale.set(...scale),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=order=>{//multiilayers
1010
1011
  this.morph.renderOrder=order},this.initialise=(textureData,finishCallback)=>{if(textureData){var locations=textureData.locations;locations&&0<locations.length&&(this.applyTransformation(locations[0].orientation,locations[0].position,locations[0].scale),"flipY"in locations[0]&&(flipY=locations[0].flipY)),this.createSlides(textureData.settings.slides),finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}},this.showEdges=color=>{if(!edgesLine){var geometry=new THREE.BoxGeometry(1,1,1);geometry.translate(.5,.5,.5);var edges=new THREE.EdgesGeometry(geometry);edgesLine=new THREE.LineSegments(edges,new THREE.LineBasicMaterial({color})),this.group.add(edgesLine)}else edgesLine.material.color=color;edgesLine.visible=!0},this.hideEdges=()=>{edgesLine&&(edgesLine.visible=!1)}};/**
1011
1012
  * Provides a class which create a texture stacks in a block
1012
1013
  * with shaders allowing slices of texture to be displayed.
1013
- *
1014
+ *
1014
1015
  * @param {TextureArray} textureIn - An object of texture array
1015
1016
  * holding texture information.
1016
- *
1017
+ *
1017
1018
  * @class
1018
1019
  * @author Alan Wu
1019
1020
  * @return {TextureSlides}
@@ -1031,20 +1032,20 @@ var THREE=__webpack_require__(4),glslVersion=THREE.GLSL3,fs="\nprecision highp f
1031
1032
 
1032
1033
  var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),TexturePrimitive=function(textureIn){/**
1033
1034
  * Load texture data into this primitves.
1034
- *
1035
+ *
1035
1036
  * @param {Object} textureData - contains the informations about the textures.
1036
1037
  * @param {Function} finishCallback - User's function to be called once texture's
1037
1038
  * is loaded.
1038
1039
  */ /**
1039
1040
  * Initialise a texture based on the provided textureData, this should be used
1040
1041
  * internally only.
1041
- *
1042
+ *
1042
1043
  * @param {Object} textureData - contains the informations about the textures.
1043
1044
  * @param {Function} finishCallback - User's function to be called once texture's
1044
1045
  * is loaded.
1045
1046
  */(__webpack_require__(10).ZincObject).call(this),this.isTexturePrimitive=!0,this.texture=textureIn,this.load=(textureData,finishCallback)=>{if(textureData&&textureData.images&&textureData.images.source){var texture=new((__webpack_require__(25).TextureArray)),imgArray=[];textureData.images.source.forEach(img=>{imgArray.push(resolveURL(img))});var _this=this;texture.loadFromImages(imgArray).then(()=>{_this.texture=texture,_this.initialise(textureData,finishCallback)})}},this.initialise=(textureData,finishCallback)=>{finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}};/**
1046
1047
  * Provides a base class object which stores textures and rendering object.
1047
- *
1048
+ *
1048
1049
  * @class
1049
1050
  * @author Alan Wu
1050
1051
  * @return {TexturePrimitive}
@@ -1274,7 +1275,7 @@ module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGlu
1274
1275
  var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),createNewURL=(__webpack_require__(5).createNewURL),isRegionGroup=(__webpack_require__(5).isRegionGroup),STLLoader=(__webpack_require__(36).STLLoader),OBJLoader=(__webpack_require__(37).OBJLoader),PrimitivesLoader=(__webpack_require__(38).PrimitivesLoader);/**
1275
1276
  * A helper class to help with reading / importing primitives and
1276
1277
  * settings into a {@link Scene}.
1277
- *
1278
+ *
1278
1279
  * @class
1279
1280
  * @param {Object} containerIn - Container to create the renderer on.
1280
1281
  * @author Alan Wu
@@ -1283,7 +1284,7 @@ var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),
1283
1284
  * This function returns a three component array, which contains
1284
1285
  * [totalsize, totalLoaded and errorDownload] of all the downloads happening
1285
1286
  * in this scene.
1286
- * @returns {Array}
1287
+ * @returns {Array}
1287
1288
  */this.getDownloadProgress=()=>{var totalSize=0,totalLoaded=0,unknownFound=!1;for(var key in this.progressMap){var progress=this.progressMap[key];totalSize+=progress[1],totalLoaded+=progress[0],0==progress[1]&&(unknownFound=!0)}return unknownFound&&(totalSize=0),[totalSize,totalLoaded,errorDownload]},this.onProgress=id=>xhr=>{this.progressMap[id]=[xhr.loaded,xhr.total]},this.onError=finishCallback=>xhr=>{--this.toBeDownloaded,errorDownload=!0,console.error("There is an issue with external resource ".concat(null!==xhr&&void 0!==xhr&&xhr.responseURL?": "+(null===xhr||void 0===xhr?void 0:xhr.responseURL):"","."));finishCallback&&finishCallback({type:"Error",xhr})};var loadMultipleViews=(referenceURL,views)=>{var defaultView=views.Default;if(views.Inline)scene.setupMultipleViews(defaultView,views.Entries);else{var promises=[],_loop=function _loop(key){referenceURL&&(newURL=createNewURL(value,referenceURL),promises.push(new Promise((resolve,reject)=>{// Add parameters if we are sent them
1288
1289
  fetch(newURL).then(response=>response.json()).then(data=>resolve({key:key,data:data})).catch(data=>reject(data))})))};for(var[key,value]of Object.entries(views.Entries))_loop(key);Promise.all(promises).then(values=>{var entries={};values.forEach(entry=>{entries[entry.key]=entry.data}),scene.setupMultipleViews(defaultView,entries);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.setCurrentViewport(defaultView),viewLoaded=!0})}};/**
1289
1290
  * Load the viewport from an external location provided by the url.
@@ -1291,7 +1292,7 @@ fetch(newURL).then(response=>response.json()).then(data=>resolve({key:key,data:d
1291
1292
  */this.loadViewURL=(url,finishCallback)=>{this.toBeDownloaded+=1;var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState)if(200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.setupMultipleViews("default",{default:viewData}),scene.resetView(),viewLoaded=!0,--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()}else this.onError(finishCallback)({responseURL:url})};var requestURL=resolveURL(url);xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.loadModelsURL=(region,urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{var number=urls.length;this.toBeDownloaded+=number;for(var i=0;i<number;i++){var filename=urls[i],colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity);colours!=null&&colours[i]!=null&&(colour=!!colours[i]),opacities!=null&&opacities[i]!=null&&(opacity=opacities[i]);var localTimeEnabled=0;timeEnabled!=null&&timeEnabled[i]!=null&&(localTimeEnabled=!!timeEnabled[i]);var localMorphColour=0;morphColour!=null&&morphColour[i]!=null&&(localMorphColour=!!morphColour[i]),primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))}},this.loadFromViewURL=(targetRegion,jsonFilePrefix,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.loadView(viewData);for(var filename,urls=[],filename_prefix=jsonFilePrefix+"_",i=0;i<viewData.numberOfResources;i++)filename=filename_prefix+(i+1)+".json",urls.push(filename);this.loadModelsURL(targetRegion,urls,viewData.colour,viewData.opacity,viewData.timeEnabled,viewData.morphColour,finishCallback)}};var requestURL=resolveURL(jsonFilePrefix+"_view.json");xmlhttp.open("GET",requestURL,!0),xmlhttp.send()};//Internal loader for a regular zinc geometry.
1292
1293
  var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,lod,tubeLines,finishCallback)=>(geometry,materials)=>{var newLines=tubeLines?new((__webpack_require__(39).TubeLines)):new((__webpack_require__(24).Lines)),material=void 0;materials&&materials[0]&&(material=new THREE.LineBasicMaterial({color:materials[0].color.clone()}),1>materials[0].opacity&&(material.transparent=!0),material.opacity=materials[0].opacity,material.morphTargets=localTimeEnabled,material.vertexColors=materials[0].vertexColors);var options={localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour};if(newLines&&(newLines.createLineSegment(geometry,material,options),newLines.setName(groupName),newLines.setAnatomicalId(anatomicalId),newLines.setRenderOrder(renderOrder),region.addZincObject(newLines),newLines.setDuration(scene.getDuration()),lod&&lod.levels))for(var[key,value]of Object.entries(lod.levels))newLines.addLOD(primitivesLoader,key,value.URL,value.Index,lod.preload);--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
1293
1294
  * Load lines into this scene object.
1294
- *
1295
+ *
1295
1296
  * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
1296
1297
  * @param {Boolean} morphColour - Indicate if color morphing is enabled.
1297
1298
  * @param {STRING} groupName - name to assign the pointset's groupname to.
@@ -1301,17 +1302,17 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
1301
1302
  //Internal loader for zinc pointset.
1302
1303
  /**
1303
1304
  * Read a STL file into this scene, the geometry will be presented as
1304
- * {@link Zinc.Geometry}.
1305
- *
1305
+ * {@link Zinc.Geometry}.
1306
+ *
1306
1307
  * @param {STRING} url - location to the STL file.
1307
1308
  * @param {STRING} groupName - name to assign the geometry's groupname to.
1308
1309
  * @param {Function} finishCallback - Callback function which will be called
1309
1310
  * once the STL geometry is succssfully loaded.
1310
1311
  */this.loadSTL=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),loader=new STLLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))},this.loadOBJ=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),loader=new OBJLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))};/**
1311
- * Load a geometry into this scene, this is a subsequent called from
1312
+ * Load a geometry into this scene, this is a subsequent called from
1312
1313
  * {@link Zinc.Scene#loadMetadataURL}, although it can be used to read
1313
1314
  * in geometry into the scene externally.
1314
- *
1315
+ *
1315
1316
  * @param {String} url - regular json model file providing geometry.
1316
1317
  * @param {Boolean} timeEnabled - Indicate if geometry morphing is enabled.
1317
1318
  * @param {Boolean} morphColour - Indicate if color morphing is enabled.
@@ -1323,22 +1324,22 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
1323
1324
  //allCompletedCallback is called
1324
1325
  /**
1325
1326
  * Load a pointset into this scene object.
1326
- *
1327
+ *
1327
1328
  * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
1328
1329
  * @param {Boolean} morphColour - Indicate if color morphing is enabled.
1329
1330
  * @param {STRING} groupName - name to assign the pointset's groupname to.
1330
1331
  * @param {Function} finishCallback - Callback function which will be called
1331
1332
  * once the glyphset is succssfully load in.
1332
- */this.loadPointsetURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1,timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;if(isInline){var object=primitivesLoader.parse(url);pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)};var loadTexture=(region,referenceURL,textureData,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0,newTexture=void 0;if(textureData){if(referenceURL&&textureData.images&&textureData.images.source)for(var _newURL,source=textureData.images.source,i=0;i<source.length;i++)_newURL=createNewURL(source[i],referenceURL),textureData.images.source[i]=_newURL;if("slides"===textureData.type&&(newTexture=new((__webpack_require__(27).TextureSlides))),newTexture){newTexture.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.setAnatomicalId(anatomicalId),newTexture.setRenderOrder(renderOrder),region.addZincObject(newTexture)}}},onLoadTextureReady=(region,xmlhttp,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var textureData=JSON.parse(xmlhttp.responseText);loadTexture(region,xmlhttp.responseURL,textureData,groupName,finishCallback,options)}};//Load a glyphset into this scene.
1333
+ */this.loadPointsetURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1,timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;if(isInline){var object=primitivesLoader.parse(url);pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)};var loadTexture=(region,referenceURL,textureData,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0,newTexture=void 0;if(textureData){if(referenceURL&&textureData.images&&textureData.images.source)for(var _newURL,source=textureData.images.source,i=0;i<source.length;i++)_newURL=createNewURL(source[i],referenceURL),textureData.images.source[i]=_newURL;if("slides"===textureData.type&&(newTexture=new((__webpack_require__(27).TextureSlides))),newTexture){newTexture.groupName=groupName;var myCallback=()=>{region.addZincObject(newTexture),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.setAnatomicalId(anatomicalId),newTexture.setRenderOrder(renderOrder)}}},onLoadTextureReady=(region,xmlhttp,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var textureData=JSON.parse(xmlhttp.responseText);loadTexture(region,xmlhttp.responseURL,textureData,groupName,finishCallback,options)}};//Load a glyphset into this scene.
1333
1334
  /**
1334
1335
  * Load a texture into this scene object.
1335
- *
1336
+ *
1336
1337
  * @param {STRING} groupName - name to assign the pointset's groupname to.
1337
1338
  * @param {Function} finishCallback - Callback function which will be called
1338
1339
  * once the glyphset is succssfully load in.
1339
1340
  */this.loadTextureURL=(region,url,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadTexture(region,void 0,url,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadTextureReady(region,xmlhttp,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(url),!0),xmlhttp.send()}},this.loadGlyphsetURL=(region,metaurl,glyphurl,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadGlyphset(region,metaurl,glyphurl,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadGlyphsetReady(region,xmlhttp,glyphurl,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(metaurl),!0),xmlhttp.send()}};/**
1340
1341
  * Add a user provided {THREE.Geometry} into the scene as zinc geometry.
1341
- *
1342
+ *
1342
1343
  * @param {Three.Geometry} geometry - The threejs geometry to be added as {@link Zinc.Geometry}.
1343
1344
  * @param {THREE.Color} color - Colour to be assigned to this geometry, overrided if materialIn is provided.
1344
1345
  * @param {Number} opacity - Opacity to be set for this geometry, overrided if materialIn is provided.
@@ -1347,7 +1348,7 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
1347
1348
  * @param {Boolean} external - Set this to true if morph geometry is present, overrided if materialIn is provided.
1348
1349
  * @param {Function} finishCallback - Callback once the geometry has been added succssfully.
1349
1350
  * @param {THREE.Material} materialIn - Material to be set for this geometry if it is present.
1350
- *
1351
+ *
1351
1352
  * @returns {Zinc.Geometry}
1352
1353
  */var addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName,renderOrder,anatomicalId)=>{var options={colour:colour,opacity:opacity,localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour},newGeometry=new((__webpack_require__(3).Geometry));return newGeometry.createMesh(geometryIn,materialIn,options),newGeometry.getMorph()?(newGeometry.setName(groupName),newGeometry.setRenderOrder(renderOrder),newGeometry.setAnatomicalId(anatomicalId),region&&region.addZincObject(newGeometry),newGeometry.setDuration(scene.getDuration()),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGeometry),newGeometry.videoHandler&&scene.setVideoHandler(newGeometry.videoHandler),newGeometry):void 0},meshloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)=>(geometry,materials)=>{var material;materials&&materials[0]&&(material=materials[0]);var zincGeometry=addZincGeometry(region,geometry,colour,opacity,localTimeEnabled,localMorphColour,void 0,material,groupName,renderOrder,anatomicalId);if(options.lod&&options.lod.levels)for(var[key,value]of Object.entries(options.lod.levels))zincGeometry.addLOD(primitivesLoader,key,value.URL,value.Index,options.lod.preload);--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)},parseDuration=durationString=>{var regex=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,[,years,months,weeks,days,hours,mins,secs]=durationString.match(regex);return{years:years,months:months,weeks:weeks,days:days,hours:hours,mins:mins,secs:secs}};//Internal loader for a regular zinc geometry.
1353
1354
  //Turn ISO 8601 duration string into an array.
@@ -1358,7 +1359,7 @@ if(item.Duration){var duration=parseDuration(item.Duration);scene.setDurationFro
1358
1359
  var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(_newURL2,referenceURL))):item.Inline&&(_newURL2=item.Inline.URL,isInline=!0);var lod={};if(item.LOD&&item.LOD.Levels){lod.preload=!!item.LOD.Preload,lod.levels={};for(var[key,value]of Object.entries(item.LOD.Levels))lod.levels[key]={},lod.levels[key].URL=createNewURL(value.URL,referenceURL),lod.levels[key].Index=value.Index}var groupName=item.GroupName;(groupName===void 0||""===groupName)&&(groupName="_Unnamed");var options={loaderOptions:{index:item.Index},isInline:isInline,fileFormat:item.FileFormat,anatomicalId:item.AnatomicalId,compression:item.compression,tubeLines:item.tubeLines,lod:lod,renderOrder:order};switch(item.Type){case"Surfaces":loadSurfaceURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Glyph":var newGeometryURL;isInline?newGeometryURL=item.Inline.GlyphGeometriesURL:(newGeometryURL=item.GlyphGeometriesURL,newGeometryURL=createNewURL(item.GlyphGeometriesURL,referenceURL)),item.DisplayLabels&&(options.displayLabels=!0),this.loadGlyphsetURL(region,_newURL2,newGeometryURL,groupName,finishCallback,options);break;case"Points":this.loadPointsetURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Lines":this.loadLinesURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Texture":this.loadTextureURL(region,_newURL2,groupName,finishCallback,options);break;default:}}},readViewAndSettingsItem=(referenceURL,item,finishCallback)=>{if(item){var _newURL3=void 0,isInline=!1;switch(item.URL?(_newURL3=item.URL,referenceURL&&(_newURL3=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL3=item.Inline.URL,isInline=!0),item.Type){case"View":isInline?(scene.setupMultipleViews("default",{default:_newURL3}),viewLoaded=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()):this.loadViewURL(_newURL3,finishCallback);break;case"Settings":this.loadSettings(item);break;default:}}};//Function to read the view item first
1359
1360
  /**
1360
1361
  * Load GLTF into this scene object.
1361
- *
1362
+ *
1362
1363
  * @param {String} url - URL to the GLTF file
1363
1364
  * @param {Function} finishCallback - Callback function which will be called
1364
1365
  * once the glyphset is succssfully load in.
@@ -1369,7 +1370,7 @@ for(var filteredMetada=supplementMetadataInArray(metadata,options),numberOfObjec
1369
1370
  metadata.Settings&&this.loadSettings(metadata.Settings),metadata.Views&&loadMultipleViews(referenceURL,metadata.Views,referenceURL),metadata.Regions&&loadRegions(targetRegion,referenceURL,metadata.Regions,callback)};/**
1370
1371
  * Load a metadata file from the provided URL into this scene. Once
1371
1372
  * succssful scene proceeds to read each items into scene for visualisations.
1372
- *
1373
+ *
1373
1374
  * @param {String} url - Location of the metadata file
1374
1375
  * @param {Function} finishCallback - Callback function which will be called
1375
1376
  * @param {options} Optional settings, it can be used to ignore some regions/groups