@cornerstonejs/tools 1.24.0 → 1.25.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/esm/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
30
30
  },
31
31
  "dependencies": {
32
- "@cornerstonejs/core": "^1.24.0",
32
+ "@cornerstonejs/core": "^1.25.0",
33
33
  "lodash.clonedeep": "4.5.0",
34
34
  "lodash.get": "^4.4.2"
35
35
  },
@@ -52,5 +52,5 @@
52
52
  "type": "individual",
53
53
  "url": "https://ohif.org/donate"
54
54
  },
55
- "gitHead": "7db76a5a136c78e1532f0abe90f4c2f9613ac68f"
55
+ "gitHead": "d3a8801264dd9284a1839aa74ec4d3685240e163"
56
56
  }
@@ -50,7 +50,7 @@ class Colorbar extends Widget {
50
50
  props.ticks?.position ?? DEFAULTS.RANGE_TEXT_POSITION;
51
51
 
52
52
  this._canvas.appendTo(this.rootElement);
53
- this._ticksBar.appendTo(document.body);
53
+ this._ticksBar.appendTo(this.rootElement);
54
54
 
55
55
  this._addRootElementEventListeners();
56
56
  }
@@ -127,6 +127,8 @@ class Colorbar extends Widget {
127
127
  const rootElement = document.createElement('div');
128
128
 
129
129
  Object.assign(rootElement.style, {
130
+ position: 'relative',
131
+ fontSize: '0',
130
132
  width: '100%',
131
133
  height: '100%',
132
134
  });
@@ -136,6 +138,7 @@ class Colorbar extends Widget {
136
138
 
137
139
  protected onContainerResize() {
138
140
  super.onContainerResize();
141
+ this.updateTicksBar();
139
142
  this._canvas.size = this.containerSize;
140
143
  }
141
144
 
@@ -224,8 +227,6 @@ class Colorbar extends Widget {
224
227
  }
225
228
 
226
229
  const { _ticksBar: ticksBar, _rangeTextPosition: rangeTextPosition } = this;
227
- const { top: containerTop, left: containerLeft } =
228
- this.rootElement.getBoundingClientRect();
229
230
  const isHorizontal = containerWidth >= containerHeight;
230
231
  const width = isHorizontal ? containerWidth : DEFAULTS.TICKS_BAR_SIZE;
231
232
  const height = isHorizontal ? DEFAULTS.TICKS_BAR_SIZE : containerHeight;
@@ -248,19 +249,17 @@ class Colorbar extends Widget {
248
249
  ticksBar.size = { width, height };
249
250
 
250
251
  if (isHorizontal) {
252
+ ticksBarLeft = 0;
251
253
  ticksBarTop =
252
254
  rangeTextPosition === ColorbarRangeTextPosition.Top
253
- ? containerTop - height
254
- : containerTop + containerHeight;
255
-
256
- ticksBarLeft = containerLeft;
255
+ ? -height
256
+ : containerHeight;
257
257
  } else {
258
- ticksBarTop = containerTop;
259
-
258
+ ticksBarTop = 0;
260
259
  ticksBarLeft =
261
260
  rangeTextPosition === ColorbarRangeTextPosition.Left
262
- ? containerLeft - width
263
- : containerLeft + containerWidth;
261
+ ? -width
262
+ : containerWidth;
264
263
  }
265
264
 
266
265
  ticksBar.top = ticksBarTop;
@@ -161,6 +161,9 @@ class ColorbarCanvas {
161
161
  const canvas = document.createElement('canvas');
162
162
 
163
163
  Object.assign(canvas.style, {
164
+ position: 'absolute',
165
+ top: '0',
166
+ left: '0',
164
167
  pointerEvents: 'none',
165
168
  boxSizing: 'border-box',
166
169
  });