phetsims / projectile-motion

"Projectile Motion" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
15 stars 13 forks source link

Instrument Flatirons easter egg #246

Closed arouinfar closed 2 years ago

arouinfar commented 3 years ago

For #244

When the altitude is 1500-1700m, an image of the Flatirons appears (Drag & Lab screens). Clients may want to remove this easter egg, so it needs to be instrumented. We probably can't just slap a visibleProperty on it because the model needs to be in control of its visibility.

This seems somewhat parallel to phScale.macroScreen.view.neutralIndicatorNode which was handled by wrapping it in another Node that the client can hide, see https://github.com/phetsims/ph-scale/issues/102.

zepumph commented 3 years ago

Although a very similar problem to https://github.com/phetsims/ph-scale/issues/102, I ended up solving it differently because BackgroundNode, which houses the flatirons image, had no PhET-iO instrumentation at all. Instead of making that overly complicated, I just added a single Property to the screen view to be able to toggle whether or not the flat irons can be shown.

projectileMotion.dragScreen.view.flatIronsVisibleProperty

I don't love the name currently, and with it was something more like flatIronsCanBeVisibleProperty, but I'm happy to leave it in semi-precedence with how https://github.com/phetsims/ph-scale/issues/102 was (with two visibleProperties that had to align for it to be visible).

Please review.

arouinfar commented 3 years ago

The new property is behaving well, thanks! Two tweaks:

zepumph commented 3 years ago

Done

arouinfar commented 2 years ago

Thanks @zepumph. Looks good in master, closing.