Skip to content

Commit

Permalink
add assertions to get more info, #321
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 2, 2022
1 parent d570cf6 commit 22452ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/common/view/FramedImageNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class FramedImageNode extends Node {
const initialHeight = parentNode.height;
const scaleX = ( viewBounds.width / initialWidth ) || GOConstants.MIN_SCALE; // prevent zero scale
const scaleY = ( viewBounds.height / initialHeight ) || GOConstants.MIN_SCALE; // prevent zero scale

//TODO https://github.com/phetsims/geometric-optics/issues/321 Assertion failed: scales should be finite
assert && assert( isFinite( scaleX ), `scaleX is not finite: ${scaleX}, initialWidth=${initialWidth} viewBounds.width=${viewBounds.width}` );
assert && assert( isFinite( scaleY ), `scaleY is not finite: ${scaleY}, initialHeight=${initialWidth} viewBounds.height=${viewBounds.width}` );

parentNode.scale( scaleX, scaleY );
parentNode.translation = new Vector2( viewBounds.minX, viewBounds.minY );
};
Expand Down

0 comments on commit 22452ae

Please sign in to comment.