phetsims / collision-lab

"Collision Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 4 forks source link

Polish: make momenta diagram vectors spacing visually uniform for 1D screens. #164

Closed brandonLi8 closed 4 years ago

brandonLi8 commented 4 years ago

Apart of #158, but since it will require larger changes I'm making a separate issue.

@ariel-phet requested that the spacing between the momenta diagram vectors for 1D screens be the same visually (same number of pixels apart, rather than the same grid-spacing apart). That way, regardless of the zoom-level, they are separated the same. This shouldn't impact learning goals since the vectors can be "anywhere in space."

I said:

Hmm, so this is probably possible but would require some refactoring (~30ish minutes?). Mainly because the momenta diagram is its own separate model, so it’s easy to sort of space them in terms of model units (grid units). What would have to be done is to also model the bounds/zoom in the model (rather than having it be a view specific thing), then calculate in grid units the spacing based on the zoom that would make it space the same visually.

I will be starting this now.

brandonLi8 commented 4 years ago

This worked out really well. @ariel-phet please review https://phet-dev.colorado.edu/html/collision-lab/1.1.0-dev.6/phet/collision-lab_en_phet.html

ariel-phet commented 4 years ago

Looks perfect. Closing

arouinfar commented 4 years ago

We reviewed this in the 8/27/20 design meeting. The uniform spacing looks great, but the total vector can be obscured by the zoom buttons when there are four balls. image

We decided to shift all of the vectors up by half a grid to avoid the occlusion.

jonathanolson commented 4 years ago

I've been looking into this, and I realized that I'm not sure what the desired behavior should be for non-starting zoom levels. Presumably we wouldn't want it to be a full half-grid-square on the most-zoomed in, since then I believe the top arrow would be off of the diagram?

arouinfar commented 4 years ago

The y-position of the vectors on the Intro/1D screens is independent of the zoom level:

I'm not sure how it's specified in the code, but could we instead reduce the padding between the vectors by 10-20%? Essentially, I'd like to reduce the padding just enough that the total is never obscured by the zoom buttons.

jonathanolson commented 4 years ago

Adjusted with the above commit, so the maximum fits like so:

image

The default is still "centered" at the same point:

image

Thoughts on this behavior? Can you try out master and see how it feels?

arouinfar commented 4 years ago

Thanks @jonathanolson! It looks great in master.