@niivue/niivue 0.18.0 → 0.18.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.
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.18.0/dist/niivue.umd.js"></script>
41
+ <script src="https://unpkg.com/@niivue/niivue@0.18.1/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
@@ -12867,8 +12867,9 @@ Niivue.prototype.setVolume = function(volume, toIndex = 0) {
12867
12867
  if (toIndex > numberOfLoadedImages) {
12868
12868
  return;
12869
12869
  }
12870
- this.getVolumeIndexByID(volume.id);
12870
+ let volIndex = this.getVolumeIndexByID(volume.id);
12871
12871
  if (toIndex === 0) {
12872
+ this.volumes.splice(volIndex, 1);
12872
12873
  this.volumes.unshift(volume);
12873
12874
  this.back = this.volumes[0];
12874
12875
  this.overlays = this.volumes.slice(1);
@@ -12881,8 +12882,10 @@ Niivue.prototype.setVolume = function(volume, toIndex = 0) {
12881
12882
  this.overlays = [];
12882
12883
  }
12883
12884
  } else {
12885
+ this.volumes.splice(volIndex, 1);
12884
12886
  this.volumes.splice(toIndex, 0, volume);
12885
12887
  this.overlays = this.volumes.slice(1);
12888
+ this.back = this.volumes[0];
12886
12889
  }
12887
12890
  this.updateGLVolume();
12888
12891
  this.volumes.map((v) => {
@@ -14010,7 +14013,7 @@ Niivue.prototype.drawScene = function() {
14010
14013
  this.gl.clearColor(this.opts.backColor[0], this.opts.backColor[1], this.opts.backColor[2], this.opts.backColor[3]);
14011
14014
  this.gl.clear(this.gl.COLOR_BUFFER_BIT);
14012
14015
  let posString = "";
14013
- if (!this.back.dims) {
14016
+ if (this.volumes.length === 0 || typeof this.volumes[0].dims === "undefined") {
14014
14017
  this.drawLoadingText(this.loadingText);
14015
14018
  return;
14016
14019
  }