-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion in debug build only #70
Comments
@jessegreenberg this is really confusing. When inspecting the error, the icon appears to have the appropriate width and height attributes when passed to |
I am also confused and don't know why this is happening. Since this issue is related to phetsims/qa#204, lets add to developer meeting agenda to see if anyone more familiar with the debug build or image plugin has thoughts about why this is happening. |
I verified that this is not an issue in other sims, including forces-and-motion-basics which also uses |
I attempted to reproduce this problem. I pulled all repos and am up to date in master. Then I ran build john-travoltage and launched http://localhost/john-travoltage/build/phet/john-travoltage_all_phet_debug.html in Mac Chrome with the Dev Tools open. There is no assertion error. I also tried http://localhost/john-travoltage/build/phet/john-travoltage_all_phet_debug.html?ea and likewise saw no issues. Same behavior in firefox. Can you please elaborate how you are creating the problem? |
Thanks for checking @samreid, this issue so far seems specific to coulombs-law. I just pulled all repos and ran
We are not hitting this assertion in RequireJS. EDIT: Stack trace shows this coming from CoulombsLawMacroScreen, but might happen for both screens in this sim. |
The problem is that the Screen constructor is called before // Validate icon sizes, after launch occurs, because that makes sure the images have the desired size
setTimeout( function() {
validateIconSize( options.homeScreenIcon, MINIMUM_HOME_SCREEN_ICON_SIZE, HOME_SCREEN_ICON_ASPECT_RATIO, 'homeScreenIcon' );
validateIconSize( options.navigationBarIcon, MINIMUM_NAVBAR_ICON_SIZE, NAVBAR_ICON_ASPECT_RATIO, 'navigationBarIcon' );
}, 0 ); and this worked properly. However, this is a risky solution because on some platforms, the next frame may be too soon. It seems we need (a) a way to load the images before or (b) a way to validate them after load. @jonathanolson was involved with image loading and may know more. |
Other possibilities: (1) Add a listener that validates after |
After further investigation, @chrisklus and I discovered the problem unique to Coulomb's Law is that it is creating the Screens before images are loaded. We revised that in the above commit and now it's launching well. Removing from developer meeting and leaving assigned to @jessegreenberg and @mbarlow12 to verify. Do we need a coding style note that checks Screens are created in launch, or is the image validation a good enough way of catching that? |
I think there needs to be some documentation. We may also want to update or add some comments to the |
Thanks for the help with this @samreid and @chrisklus! There is some documentation already in SimLauncher.js
And in Image.js
|
We could be to add a line of documentation in simula-rasa-main.js to warn that Images shouldn't be create outside of SimLauncher.launch if it is important for their dimensions to be defined. |
… bounds until the image is fully loaded, see phetsims/coulombs-law#70
I added a comment about this. @mbarlow12 @samreid is this helpful or noise? Otherwise, I think this issue can be closed. EDIT: I also tested that 9888e4e fixed this issue. |
Removing my assignment. @samreid I think we can close as well. |
Looks good, thanks @jessegreenberg, closing. |
While looking into phetsims/john-travoltage#317, we noticed that this assertion is hit in the the _debug.html version. This isn't happening in RequireJS which is very strange. Here is the assertion.
I am not sure what could be causing this error only in the debug version. This sim is currently in dev testing, so @mbarlow12 so he is aware.
The text was updated successfully, but these errors were encountered: