@niivue/niivue 0.12.1 → 0.12.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/README.md +1 -1
- package/dist/niivue.es.js +16 -7
- package/dist/niivue.umd.js +6 -6
- package/package.json +1 -1
- package/src/index.html +2 -1
- package/src/niivue.js +16 -8
- package/src/nvimage.js +1 -0
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
38
38
|
|
|
39
39
|
## existing html page
|
|
40
40
|
```html
|
|
41
|
-
<script src="https://unpkg.com/@niivue/niivue@0.12.
|
|
41
|
+
<script src="https://unpkg.com/@niivue/niivue@0.12.2/dist/niivue.umd.js"></script>
|
|
42
42
|
|
|
43
43
|
<canvas id="gl" height=480 width=640></canvas>
|
|
44
44
|
|
package/dist/niivue.es.js
CHANGED
|
@@ -12367,6 +12367,8 @@ const Niivue = function(options = {}) {
|
|
|
12367
12367
|
this.clipPlaneObject3D = null;
|
|
12368
12368
|
this.intensityRange$ = new Subject();
|
|
12369
12369
|
this.scene.location$ = new Subject();
|
|
12370
|
+
this.scene.loading$ = new Subject();
|
|
12371
|
+
this.loadingText = "drag and drop to start";
|
|
12370
12372
|
this.currentClipPlaneIndex = 0;
|
|
12371
12373
|
this.lastCalled = new Date().getTime();
|
|
12372
12374
|
this.multiTouchGesture = false;
|
|
@@ -12380,7 +12382,8 @@ const Niivue = function(options = {}) {
|
|
|
12380
12382
|
this.opts[prop] = options[prop] === void 0 ? this.defaults[prop] : options[prop];
|
|
12381
12383
|
}
|
|
12382
12384
|
this.eventsToSubjects = {
|
|
12383
|
-
location: this.scene.location
|
|
12385
|
+
location: this.scene.location$,
|
|
12386
|
+
loading: this.scene.loading$
|
|
12384
12387
|
};
|
|
12385
12388
|
this.subscriptions = [];
|
|
12386
12389
|
};
|
|
@@ -12900,14 +12903,24 @@ Niivue.prototype.cloneVolume = function(index) {
|
|
|
12900
12903
|
return this.volumes[index].clone();
|
|
12901
12904
|
};
|
|
12902
12905
|
Niivue.prototype.loadVolumes = async function(volumeList) {
|
|
12906
|
+
this.on("loading", (isLoading) => {
|
|
12907
|
+
if (isLoading) {
|
|
12908
|
+
this.loadingText = "loading...";
|
|
12909
|
+
this.drawScene();
|
|
12910
|
+
} else {
|
|
12911
|
+
this.loadingText = "drag and drop to start";
|
|
12912
|
+
}
|
|
12913
|
+
});
|
|
12903
12914
|
if (!this.initialized) {
|
|
12904
12915
|
await this.init();
|
|
12905
12916
|
}
|
|
12906
12917
|
this.volumes = [];
|
|
12907
12918
|
this.gl.clearColor(0, 0, 0, 1);
|
|
12908
12919
|
this.gl.clear(this.gl.COLOR_BUFFER_BIT);
|
|
12920
|
+
this.scene.loading$.next(true);
|
|
12909
12921
|
for (let i = 0; i < volumeList.length; i++) {
|
|
12910
12922
|
let volume = await NVImage.loadFromUrl(volumeList[i].url, volumeList[i].name, volumeList[i].colorMap, volumeList[i].opacity, this.opts.trustCalMinMax);
|
|
12923
|
+
this.scene.loading$.next(false);
|
|
12911
12924
|
this.volumes.push(volume);
|
|
12912
12925
|
if (i === 0) {
|
|
12913
12926
|
this.back = volume;
|
|
@@ -13013,7 +13026,7 @@ Niivue.prototype.initText = async function() {
|
|
|
13013
13026
|
this.fontShader = new Shader(this.gl, vertFontShader, fragFontShader);
|
|
13014
13027
|
this.fontShader.use(this.gl);
|
|
13015
13028
|
await this.loadDefaultFont();
|
|
13016
|
-
this.drawLoadingText(
|
|
13029
|
+
this.drawLoadingText(this.loadingText);
|
|
13017
13030
|
};
|
|
13018
13031
|
Niivue.prototype.init = async function() {
|
|
13019
13032
|
this.gl.enable(this.gl.CULL_FACE);
|
|
@@ -13865,11 +13878,7 @@ Niivue.prototype.drawScene = function() {
|
|
|
13865
13878
|
this.gl.clear(this.gl.COLOR_BUFFER_BIT);
|
|
13866
13879
|
let posString = "";
|
|
13867
13880
|
if (!this.back.dims) {
|
|
13868
|
-
|
|
13869
|
-
this.drawLoadingText("loading");
|
|
13870
|
-
} else {
|
|
13871
|
-
this.drawLoadingText("drag and drop a file to start");
|
|
13872
|
-
}
|
|
13881
|
+
this.drawLoadingText(this.loadingText);
|
|
13873
13882
|
return;
|
|
13874
13883
|
}
|
|
13875
13884
|
if (this.sliceType === this.sliceTypeRender)
|