dwv 0.31.2 → 0.31.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/dist/dwv.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! dwv 0.31.2 2023-05-07 12:03:47 */
1
+ /*! dwv 0.31.3 2023-11-16 12:13:08 */
2
2
  // Inspired from umdjs
3
3
  // See https://github.com/umdjs/umd/blob/master/templates/returnExports.js
4
4
  (function (root, factory) {
@@ -617,6 +617,16 @@ dwv.App = function () {
617
617
  controller.initialise();
618
618
  };
619
619
 
620
+ /**
621
+ * Set the imageSmoothing flag value. Default is false.
622
+ *
623
+ * @param {boolean} flag True to enable smoothing.
624
+ */
625
+ this.setImageSmoothing = function (flag) {
626
+ stage.setImageSmoothing(flag);
627
+ stage.draw();
628
+ };
629
+
620
630
  /**
621
631
  * Get the layer group configuration from a data index.
622
632
  * Defaults to div id 'layerGroup' if no association object has been set.
@@ -4749,7 +4759,7 @@ dwv.dicom = dwv.dicom || {};
4749
4759
  * @returns {string} The version of the library.
4750
4760
  */
4751
4761
  dwv.getVersion = function () {
4752
- return '0.31.2';
4762
+ return '0.31.3';
4753
4763
  };
4754
4764
 
4755
4765
  /**
@@ -13819,6 +13829,13 @@ dwv.gui.LayerGroup = function (containerDiv) {
13819
13829
  */
13820
13830
  var currentPosition;
13821
13831
 
13832
+ /**
13833
+ * Image smoothing flag.
13834
+ *
13835
+ * @type {boolean}
13836
+ */
13837
+ var imageSmoothing = false;
13838
+
13822
13839
  /**
13823
13840
  * Get the target orientation.
13824
13841
  *
@@ -13868,6 +13885,21 @@ dwv.gui.LayerGroup = function (containerDiv) {
13868
13885
  }
13869
13886
  };
13870
13887
 
13888
+ /**
13889
+ * Set the imageSmoothing flag value.
13890
+ *
13891
+ * @param {boolean} flag True to enable smoothing.
13892
+ */
13893
+ this.setImageSmoothing = function (flag) {
13894
+ imageSmoothing = flag;
13895
+ // set for existing layers
13896
+ for (let i = 0; i < layers.length; ++i) {
13897
+ if (layers[i] instanceof dwv.gui.ViewLayer) {
13898
+ layers[i].enableImageSmoothing(flag);
13899
+ }
13900
+ }
13901
+ };
13902
+
13871
13903
  /**
13872
13904
  * Update crosshair on offset or zoom change.
13873
13905
  */
@@ -14080,6 +14112,7 @@ dwv.gui.LayerGroup = function (containerDiv) {
14080
14112
  containerDiv.append(div);
14081
14113
  // view layer
14082
14114
  var layer = new dwv.gui.ViewLayer(div);
14115
+ layer.enableImageSmoothing(imageSmoothing);
14083
14116
  // add layer
14084
14117
  layers.push(layer);
14085
14118
  // mark it as active
@@ -14693,6 +14726,9 @@ dwv.gui.Stage = function () {
14693
14726
  // binder callbacks
14694
14727
  var callbackStore = null;
14695
14728
 
14729
+ // image smoothing flag
14730
+ var imageSmoothing = false;
14731
+
14696
14732
  /**
14697
14733
  * Get the layer group at the given index.
14698
14734
  *
@@ -14758,6 +14794,7 @@ dwv.gui.Stage = function () {
14758
14794
  this.addLayerGroup = function (htmlElement) {
14759
14795
  activeLayerGroupIndex = layerGroups.length;
14760
14796
  var layerGroup = new dwv.gui.LayerGroup(htmlElement);
14797
+ layerGroup.setImageSmoothing(imageSmoothing);
14761
14798
  // add to storage
14762
14799
  var isBound = callbackStore && callbackStore.length !== 0;
14763
14800
  if (isBound) {
@@ -14895,6 +14932,18 @@ dwv.gui.Stage = function () {
14895
14932
  callbackStore = null;
14896
14933
  };
14897
14934
 
14935
+ /**
14936
+ * Set the imageSmoothing flag value.
14937
+ *
14938
+ * @param {boolean} flag True to enable smoothing.
14939
+ */
14940
+ this.setImageSmoothing = function (flag) {
14941
+ imageSmoothing = flag;
14942
+ for (let i = 0; i < layerGroups.length; ++i) {
14943
+ layerGroups[i].setImageSmoothing(flag);
14944
+ }
14945
+ };
14946
+
14898
14947
  /**
14899
14948
  * Get the binder callback function for a given layer group index.
14900
14949
  * The function is created if not yet stored.