From 22452aec03b2cfca45cfb8c07ce0fa5cd7a334be Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Wed, 2 Mar 2022 13:48:51 -0700 Subject: [PATCH] add assertions to get more info, https://github.com/phetsims/geometric-optics/issues/321 --- js/common/view/FramedImageNode.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/common/view/FramedImageNode.ts b/js/common/view/FramedImageNode.ts index 2e41222c..b6d97e75 100644 --- a/js/common/view/FramedImageNode.ts +++ b/js/common/view/FramedImageNode.ts @@ -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 ); };