From 8d87df6c0eda1f9490afc5ffa83c120cb286df87 Mon Sep 17 00:00:00 2001 From: samreid Date: Fri, 23 Oct 2015 10:52:17 -0600 Subject: [PATCH] Added a tolerance of 1E-3 around required icon aspect ratios, see #263 --- js/NavigationBar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/NavigationBar.js b/js/NavigationBar.js index e82b9520..b6da2c1b 100644 --- a/js/NavigationBar.js +++ b/js/NavigationBar.js @@ -69,7 +69,8 @@ define( function( require ) { for ( var screenIndex = 0; screenIndex < screens.length; screenIndex++ ) { var screen = screens[ screenIndex ]; var iconAspectRatio = screen.navigationBarIcon.width / screen.navigationBarIcon.height; - var validAspectRatio = iconAspectRatio === navbarIconAspectRatio || iconAspectRatio === homeScreenIconAspectRatio; + var tolerance = 1E-3; + var validAspectRatio = Math.abs( iconAspectRatio - navbarIconAspectRatio ) < tolerance || Math.abs( iconAspectRatio - homeScreenIconAspectRatio ) < tolerance; assert && assert( validAspectRatio, 'NavigationBar icons for screen ' + screenIndex + ' did not have a valid aspect ratio.' ); } }