phetsims / vegas

Reusable game components for PhET simulations.
MIT License
1 stars 4 forks source link

How should the Zoom feature work for Game Screens? #125

Closed Nancy-Salpepi closed 4 months ago

Nancy-Salpepi commented 4 months ago

While testing https://github.com/phetsims/qa/issues/1066 and https://github.com/phetsims/qa/issues/1067, I noticed that when zoomed in on the Game Screen, selecting a level doesn't return the zoom to the default setting. Wondering if the behavior should be the same as what occurs when switching screens? Typically if I zoom in on a screen and then switch screens, I will no longer be zoomed in. In the attached video, I end up not seeing anything but a yellow screen because I am zoomed in on a spot that has no elements.

Steps:

  1. In graphing lines, select the Line Game screen
  2. Zoom in
  3. Select a level

https://github.com/phetsims/vegas/assets/87318828/c27347d2-d23e-4f7c-922e-011ec45e55d4

jessegreenberg commented 4 months ago

Thanks @Nancy-Salpepi. I can't decide on whether we should do this and want to run it by others. We do this when changing screens so that

1) The user has an overview of the new screen. 2) Better panning when the screen changes. The pan/zoom listener pans to put the focused Node in the center of the viewport. When changing screens, focus is placed on the ScreenView. So if don't zoom out, changing screens would pan to the center of the ScreenView.

These arguments probably apply to the level select buttons. But there may be reasons not to, like

If you do want to zoom out, it can be done like this:

animatedPanZoomSingleton.listener.resetTransform();
pixelzoom commented 4 months ago

My opinon is that we should NOT make any change. We should reset the zoom transform (zoom to 100%) only for screen changes, and not for changes within screens. Which means NOT for returning to the Level Selection buttons. Doing so for the Level Selection buttons becomes a slippery slope. First, it feels presumptious. Second, will we start resetting zoom whenever the UI significantly changes? And have to continually discuss when to do so? This happens with scenes, difference game challenges, ... There's also nothing in vegas that would handle this automatically; each sim would need to handle it -- and remember to address it in future sims.

If you do decided to proceed with this... I'm going to consider this non-blocking for https://github.com/phetsims/graphing-lines/issues/142 (Graphing Lines 1.4). There are many other sims with Games that would require an MR, and Graphing Lines will be one of them.

amanda-phet commented 4 months ago

I think @Nancy-Salpepi 's video does show a downside to not resetting the zoom, but agree with @pixelzoom and @jessegreenberg that we'll run into many edge cases like this, such as switching scenes, showing dialog buttons, and other examples we can't think of right now, so I think we should not proceed with this kind of behavior for zooming.