Skip to content

Commit 52703b9

Browse files
fix: Resolve toFixed errors in viewport overlay after dcmjs server changes (#115)
1 parent 557594d commit 52703b9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/ViewportOverlay/ViewportOverlay.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ function getCompression(imageId) {
3838
class ViewportOverlay extends PureComponent {
3939
static propTypes = {
4040
scale: PropTypes.number.isRequired,
41-
windowWidth: PropTypes.number.isRequired,
42-
windowCenter: PropTypes.number.isRequired,
41+
windowWidth: PropTypes.oneOfType([
42+
PropTypes.number.isRequired,
43+
PropTypes.string.isRequired,
44+
]),
45+
windowCenter: PropTypes.oneOfType([
46+
PropTypes.number.isRequired,
47+
PropTypes.string.isRequired,
48+
]),
4349
imageId: PropTypes.string.isRequired,
4450
imageIndex: PropTypes.number.isRequired,
4551
stackSize: PropTypes.number.isRequired,
@@ -77,7 +83,9 @@ class ViewportOverlay extends PureComponent {
7783

7884
const frameRate = formatNumberPrecision(1000 / frameTime, 1);
7985
const compression = getCompression(imageId);
80-
const wwwc = `W: ${windowWidth.toFixed(0)} L: ${windowCenter.toFixed(0)}`;
86+
const wwwc = `W: ${
87+
windowWidth.toFixed ? windowWidth.toFixed(0) : windowWidth
88+
} L: ${windowWidth.toFixed ? windowCenter.toFixed(0) : windowCenter}`;
8189
const imageDimensions = `${columns} x ${rows}`;
8290

8391
const { imageIndex, stackSize } = this.props;

0 commit comments

Comments
 (0)