pxt-arcade
pxt-arcade copied to clipboard
Simulator frame flashes when game is loaded
When you open a game in the Kiosk app, the Simulator frame flashes on screen for a brief second before the game goes fullscreen.
I think the reason is similar to https://github.com/microsoft/pxt-arcade/issues/4786 @jwunderl had few ideas
There is an async delay between page loading and the sim buttons being hidden. The most straightforward solution would probably be to make hideSimButtons the default state and then just remove the hiding CSS if it's not set when checked later on. The downside is that it will change the current behavior across all the other places hosting the sim now since there will be a brief period of a transparent frame before the controls and game are loaded. Otherwise it'll involve a substantial change to the way controls are hidden.
@jwunderl suggested new url parameter while loading.
I don't follow.
We're passing it in runOptions, so it's currently getting picked up in initAsync after the frame has already -- instead we should be able to add it as a queryParam in createFrame in simdriver.ts so that we can read it as soon as the frame is loaded~
It sounds like we want to revert to the original implementation of this from a few weeks ago:
- https://github.com/microsoft/pxt/pull/8844/commits/7bbad2ad05a8b66ba84d67e3dc95d0301a9d290f
- https://github.com/microsoft/pxt-arcade-sim/pull/57/commits/6ca4a87eb5d0c7dcc3bb5304119f24524aabd11f
But instead:
- Pass the hideSimButtons flag as a query param instead of as a frame attribute.
- Move the code that detects the flag and applies the CSS from the HTML to a code file.
Can you confirm this is what you have in mind?
This is fixed.