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

Momentum graph arrows can go out of frame while completely zoomed out #175

Closed brooklynlash closed 4 years ago

brooklynlash commented 4 years ago

Test device Lenovo ThinkPad

Operating System Windows 10

Browser Chrome

Problem description This is for https://github.com/phetsims/QA/issues/562 While in the 1D collision section of the simulation, the momentum can get so large that even when zoomed out to the maximum possible, the arrows still go out of frame.

Steps to reproduce

  1. Open Explore 1D
  2. Increase amount of balls to 4
  3. Make all velocities max (does not matter which direction)
  4. Make all masses the biggest possible except for Ball 3 or 2
  5. Open Momenta graph and zoom all the way out
  6. Press play

Visuals

collision4 collisionissue

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Collision Lab‬ URL: https://phet-dev.colorado.edu/html/collision-lab/1.1.0-dev.10/phet/collision-lab_all_phet.html Version: 1.1.0-dev.10 2020-10-15 01:57:00 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 Language: en-US Window: 1707x818 Pixel Ratio: 2.25/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 4095 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 32767x32767 OES_texture_float: true Dependencies JSON: {}

arouinfar commented 4 years ago

Thanks @brooklynlash.

I think our zoom range should be able to accommodate extreme situations that are the result of ordinary starting conditions, such as this one. It looks like adding an additional zoom level will do the trick.

Before: image

After: image

@jonathanolson not sure if this was the correct way to do things, but I locally changed https://github.com/phetsims/collision-lab/blob/master/js/common/CollisionLabConstants.js#L55 to:

  MOMENTA_DIAGRAM_ZOOM_RANGE: new RangeWithValue( 0.125, 4, 2 ),
jonathanolson commented 4 years ago

That looks like exactly the needed change (it looks like it gets multiplied/divided by exactly 2). Committed above.

arouinfar commented 4 years ago

Looks good, thanks @jonathanolson!