Skip to content

Commit

Permalink
fix: Resolve toFixed errors in viewport overlay after dcmjs server ch…
Browse files Browse the repository at this point in the history
…anges (#115)
  • Loading branch information
igoroctaviano authored Mar 11, 2021
1 parent 557594d commit 52703b9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/ViewportOverlay/ViewportOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ function getCompression(imageId) {
class ViewportOverlay extends PureComponent {
static propTypes = {
scale: PropTypes.number.isRequired,
windowWidth: PropTypes.number.isRequired,
windowCenter: PropTypes.number.isRequired,
windowWidth: PropTypes.oneOfType([
PropTypes.number.isRequired,
PropTypes.string.isRequired,
]),
windowCenter: PropTypes.oneOfType([
PropTypes.number.isRequired,
PropTypes.string.isRequired,
]),
imageId: PropTypes.string.isRequired,
imageIndex: PropTypes.number.isRequired,
stackSize: PropTypes.number.isRequired,
Expand Down Expand Up @@ -77,7 +83,9 @@ class ViewportOverlay extends PureComponent {

const frameRate = formatNumberPrecision(1000 / frameTime, 1);
const compression = getCompression(imageId);
const wwwc = `W: ${windowWidth.toFixed(0)} L: ${windowCenter.toFixed(0)}`;
const wwwc = `W: ${
windowWidth.toFixed ? windowWidth.toFixed(0) : windowWidth
} L: ${windowWidth.toFixed ? windowCenter.toFixed(0) : windowCenter}`;
const imageDimensions = `${columns} x ${rows}`;

const { imageIndex, stackSize } = this.props;
Expand Down

0 comments on commit 52703b9

Please sign in to comment.