zincjs 1.19.0 → 1.19.2

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.19.0","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","nifti-reader-js":"^0.8.0","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.19.2","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","nifti-reader-js":"^0.8.0","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 */
@@ -1062,7 +1062,7 @@ var expandBoxWithSettings=(box,settings,vector)=>{if(settings)switch(settings.di
1062
1062
  *//**
1063
1063
  * Update the glyphsets if required the render.
1064
1064
  */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
1065
- 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.isAlphaPixelDiscarded=()=>discardAlpha,this.discardAlphaPixel=flag=>{discardAlpha=flag,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.discardAlpha.value=discardAlpha,material.needsUpdate=!0}})},this.getBrightness=()=>brightness,this.setBrightness=brightnessIn=>{brightness=brightnessIn,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.brightness.value=brightness,material.needsUpdate=!0}})},this.getContrast=()=>contrast,this.setContrast=contrastIn=>{0<=contrast&&(contrast=contrastIn,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.contrast.value=contrast,material.needsUpdate=!0}}))},this.hideEdges=()=>{edgesLine&&(edgesLine.visible=!1)},this.updateTimeTexture=()=>{var maxIndex=this.textureList.length-1,normalisedTime=this.inbuildTime/this.duration;if(this.timeEnabled&&0<maxIndex&&prevTime!==normalisedTime){var iTime=normalisedTime*maxIndex,t0=Math.floor(iTime),t1=Math.ceil(iTime),ratio=iTime-t0;console.log("update",t0,t1,ratio),this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;lt0!==t0&&(uniforms.diffuse0.value=this.textureList[t0].impl),lt1!==t1&&(uniforms.diffuse1.value=this.textureList[t1].impl),uniforms.time.value=ratio,material.needsUpdate=!0}}),lt0=t0,lt1=t1,prevTime=normalisedTime}},this.setMorphTime=time=>{var newTime=time;newTime=time>this.duration?this.duration:0>time?0:time,newTime!=this.inbuildTime&&(this.inbuildTime=newTime,this.updateTimeTexture())},this.render=(delta,playAnimation)=>{//console.log("render", delta, playAnimation, this.textureList)
1065
+ 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.isAlphaPixelDiscarded=()=>discardAlpha,this.discardAlphaPixel=flag=>{discardAlpha=flag,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.discardAlpha.value=discardAlpha,material.needsUpdate=!0}})},this.getBrightness=()=>brightness,this.setBrightness=brightnessIn=>{brightness=brightnessIn,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.brightness.value=brightness,material.needsUpdate=!0}})},this.getContrast=()=>contrast,this.setContrast=contrastIn=>{0<=contrast&&(contrast=contrastIn,this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms.contrast.value=contrast,material.needsUpdate=!0}}))},this.hideEdges=()=>{edgesLine&&(edgesLine.visible=!1)},this.updateTimeTexture=()=>{var maxIndex=this.textureList.length-1,normalisedTime=this.inbuildTime/this.duration;if(this.timeEnabled&&0<maxIndex&&prevTime!==normalisedTime){var iTime=normalisedTime*maxIndex,t0=Math.floor(iTime),t1=Math.ceil(iTime);this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;lt0!==t0&&(uniforms.diffuse0.value=this.textureList[t0].impl),lt1!==t1&&(uniforms.diffuse1.value=this.textureList[t1].impl),uniforms.time.value=iTime-t0,material.needsUpdate=!0}}),lt0=t0,lt1=t1,prevTime=normalisedTime}},this.setMorphTime=time=>{var newTime=time;newTime=time>this.duration?this.duration:0>time?0:time,newTime!=this.inbuildTime&&(this.inbuildTime=newTime,this.updateTimeTexture())},this.render=(delta,playAnimation)=>{//console.log("render", delta, playAnimation, this.textureList)
1066
1066
  if(!0==playAnimation&&this.timeEnabled&&1<this.textureList.length){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,this.updateTimeTexture()}}};/**
1067
1067
  * Provides a class which create a texture stacks in a block
1068
1068
  * with shaders allowing slices of texture to be displayed.
@@ -1100,7 +1100,7 @@ var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),
1100
1100
  * @param {Object} textureData - contains the informations about the textures.
1101
1101
  * @param {Function} finishCallback - User's function to be called once texture's
1102
1102
  * is loaded.
1103
- */(__webpack_require__(10).ZincObject).call(this),this.isTexturePrimitive=!0,this.texture=textureIn,this.textureList=[],this.texture&&this.textureList.push(this.texture),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.textureList.push(this.texture),_this.initialise(textureData,finishCallback)})}},this.addTextureArray=tArray=>{0===this.textureList.length&&this.texture&&this.textureList.push(this.texture),console.log("addTextureArray",tArray),tArray&&tArray.isTextureArray&&this.textureList.push(tArray)},this.initialise=(textureData,finishCallback)=>{finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}};/**
1103
+ */(__webpack_require__(10).ZincObject).call(this),this.isTexturePrimitive=!0,this.texture=textureIn,this.textureList=[],this.texture&&this.textureList.push(this.texture),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.textureList.push(this.texture),_this.initialise(textureData,finishCallback)})}},this.addTextureArray=tArray=>{0===this.textureList.length&&this.texture&&this.textureList.push(this.texture),tArray&&tArray.isTextureArray&&this.textureList.push(tArray)},this.initialise=(textureData,finishCallback)=>{finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}};/**
1104
1104
  * Provides a base class object which stores textures and rendering object.
1105
1105
  *
1106
1106
  * @class