zincjs 2.0.0 → 2.1.0
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 +60 -7
- package/build/zinc.js.map +1 -1
- package/package.json +2 -2
- package/src/loaders/niftiReader.js +3 -5
- package/src/primitives/glyphset.js +19 -3
- package/src/sceneLoader.js +2 -4
- package/src/zinc.js +6 -0
- package/vite.config.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zincjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "ZincJS (Web-based-Zinc-Visualisation)",
|
|
5
5
|
"main": "build/zinc.js",
|
|
6
6
|
"directories": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@vitest/coverage-v8": "^1.6.1",
|
|
49
49
|
"auto-changelog": "^2.4.0",
|
|
50
50
|
"chai": "^4.1.0",
|
|
51
|
-
"gl": "^
|
|
51
|
+
"gl": "^8.1.6",
|
|
52
52
|
"happy-dom": "^20.10.6",
|
|
53
53
|
"jsdoc": "^4.0.2",
|
|
54
54
|
"msw": "^2.14.6",
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as nifti from 'nifti-reader-js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TextureSlides
|
|
6
|
-
} from "zincjs";
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { TextureArray } from '../texture/textureArray';
|
|
4
|
+
import { TextureSlides } from '../primitives/textureSlides';
|
|
7
5
|
|
|
8
6
|
const defaultTextureSettings = {
|
|
9
7
|
"id": "mesh-location-orientation",
|
|
@@ -27,6 +27,7 @@ const Glyphset = function () {
|
|
|
27
27
|
let numberOfVertices = 0;
|
|
28
28
|
let baseSize = [0, 0, 0];
|
|
29
29
|
let offset = [0, 0, 0];
|
|
30
|
+
let labelsOn = false;
|
|
30
31
|
let scaleFactors = [0, 0, 0];
|
|
31
32
|
let repeat_mode = "NONE";
|
|
32
33
|
this.ready = false;
|
|
@@ -407,13 +408,26 @@ const Glyphset = function () {
|
|
|
407
408
|
return undefined;
|
|
408
409
|
}
|
|
409
410
|
|
|
411
|
+
this.isLabelDisplayed = () => {
|
|
412
|
+
return labelsOn;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Check whether label can be shown
|
|
417
|
+
*/
|
|
418
|
+
this.canShowLabel = () => {
|
|
419
|
+
return (glyphList?.length && (labels?.length || this.groupName));
|
|
420
|
+
}
|
|
410
421
|
|
|
411
422
|
/**
|
|
412
423
|
* Display the label of the glyphs in the glyphset.
|
|
413
424
|
*/
|
|
414
425
|
this.showLabel = () => {
|
|
415
|
-
|
|
416
|
-
|
|
426
|
+
if (glyphList?.length) {
|
|
427
|
+
labelsOn = true;
|
|
428
|
+
for (let i = 0; i < glyphList.length; i++) {
|
|
429
|
+
glyphList[i].showLabel(this.morph.material ? this.morph.material.color : undefined);
|
|
430
|
+
}
|
|
417
431
|
}
|
|
418
432
|
}
|
|
419
433
|
|
|
@@ -424,6 +438,7 @@ const Glyphset = function () {
|
|
|
424
438
|
for (let i = 0; i < glyphList.length; i++) {
|
|
425
439
|
glyphList[i].hideLabel();
|
|
426
440
|
}
|
|
441
|
+
labelsOn = false;
|
|
427
442
|
}
|
|
428
443
|
|
|
429
444
|
/**
|
|
@@ -445,7 +460,8 @@ const Glyphset = function () {
|
|
|
445
460
|
glyphList[i] = glyph;
|
|
446
461
|
this.morph.add(glyph.getGroup());
|
|
447
462
|
}
|
|
448
|
-
if
|
|
463
|
+
//Only display labels if the label list is available
|
|
464
|
+
if (labels && displayLabels) {
|
|
449
465
|
this.showLabel();
|
|
450
466
|
}
|
|
451
467
|
//Update the transformation of the glyphs.
|
package/src/sceneLoader.js
CHANGED
|
@@ -284,7 +284,7 @@ const SceneLoader = function (sceneIn) {
|
|
|
284
284
|
}
|
|
285
285
|
let isInline = (options && options.isInline) ? options.isInline : undefined;
|
|
286
286
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
287
|
-
let displayLabels =
|
|
287
|
+
let displayLabels = options?.displayLabels ? options.displayLabels : true;
|
|
288
288
|
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
289
289
|
const newGlyphset = new Glyphset();
|
|
290
290
|
newGlyphset.setDuration(scene.getDuration());
|
|
@@ -760,9 +760,7 @@ const SceneLoader = function (sceneIn) {
|
|
|
760
760
|
} else {
|
|
761
761
|
newGeometryURL = item.Inline.GlyphGeometriesURL;
|
|
762
762
|
}
|
|
763
|
-
|
|
764
|
-
options.displayLabels = true;
|
|
765
|
-
}
|
|
763
|
+
options.displayLabels = item.displayLabels ? item.displayLabels : true;
|
|
766
764
|
options.loaderOptions.isGlyphsets = true;
|
|
767
765
|
this.loadGlyphsetURL(region, newURL, newGeometryURL, groupName, finishCallback, options);
|
|
768
766
|
break;
|
package/src/zinc.js
CHANGED
|
@@ -12,6 +12,10 @@ import { TextureArray } from './texture/textureArray';
|
|
|
12
12
|
import { TextureSlides } from './primitives/textureSlides';
|
|
13
13
|
import { Renderer } from './renderer';
|
|
14
14
|
import { Scene } from './scene';
|
|
15
|
+
import {
|
|
16
|
+
createPrimitivesFromNIFTI,
|
|
17
|
+
createTextureFromNIFTI
|
|
18
|
+
} from './loaders/niftiReader';
|
|
15
19
|
//import { GeometryCSG } from './geometryCSG';
|
|
16
20
|
//import { GlyphsetCSG } from './glyphsetCSG';
|
|
17
21
|
import {
|
|
@@ -58,6 +62,8 @@ const Zinc = function() {
|
|
|
58
62
|
this.StereoEffect = StereoEffect;
|
|
59
63
|
this.loadExternalFile = loadExternalFile;
|
|
60
64
|
this.loadExternalFiles = loadExternalFiles;
|
|
65
|
+
this.createPrimitivesFromNIFTI = createPrimitivesFromNIFTI;
|
|
66
|
+
this.createTextureFromNIFTI = createTextureFromNIFTI;
|
|
61
67
|
this.THREE = THREE;
|
|
62
68
|
};
|
|
63
69
|
|
package/vite.config.js
CHANGED
|
@@ -13,7 +13,12 @@ export default defineConfig({
|
|
|
13
13
|
formats: ['es', 'umd'],
|
|
14
14
|
},
|
|
15
15
|
rollupOptions: {
|
|
16
|
-
external
|
|
16
|
+
external(id) {
|
|
17
|
+
if (id.includes("nifti-reader-js")) {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
return !id.startsWith('.') && !path.isAbsolute(id) && !id.includes('package.json')
|
|
21
|
+
},
|
|
17
22
|
output: {
|
|
18
23
|
extend: true,
|
|
19
24
|
globals: {
|
|
@@ -26,4 +31,4 @@ export default defineConfig({
|
|
|
26
31
|
},
|
|
27
32
|
assetsInlineLimit: 8192,
|
|
28
33
|
},
|
|
29
|
-
});
|
|
34
|
+
});
|