phetsims / faradays-electromagnetic-lab

"Faraday's Electromagnetic Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 0 forks source link

Object movement choppy with alt input #186

Closed Nancy-Salpepi closed 2 weeks ago

Nancy-Salpepi commented 2 weeks ago

Test device MacBook Air M1 chip

Operating System 14.5

Browser Safari 17.5 and Chrome

Problem description For https://github.com/phetsims/qa/issues/1091, objects sputter when moving across the play area with keyboard input. This becomes really obvious when zoomed in. This is seen with all draggable objects using safari and chrome. I tested published Kepler's Law and didn't see this issue with the Measuring Tape and Stopwatch.

Steps to reproduce Here is an example:

  1. On the Electromagnet Screen, zoom in enough so that the screen will pan when an object is moved across the play area
  2. Tab to and move each of the draggable objects--Electromagnet, Compass, DC Power Supply Panel and Field Meter (once checked)

Visuals

https://github.com/phetsims/faradays-electromagnetic-lab/assets/87318828/5b434509-3666-407f-9980-932ae7d93a55

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Faraday's Electromagnetic Lab‬ URL: https://phet-dev.colorado.edu/html/faradays-electromagnetic-lab/1.0.0-dev.32/phet/faradays-electromagnetic-lab_all_phet.html Version: 1.0.0-dev.32 2024-05-30 15:49:49 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Language: en-US Window: 1397x722 Pixel Ratio: 2/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: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}
pixelzoom commented 2 weeks ago

This problem is easist to see when dragging the DC Power Supply panel in the Pickup Coil screen.

@arouinfar has MacBook Pro with M1 Pro, and she sees the same behavior as @Nancy-Salpepi reported above.

I'm on MacBook Pro Intel, and I see the opposite behavior. While panning is happening, the dragging and object rendering looks nice and smooth. When panning is not happening, dragging looks jerky and rendering is lousy.

I've reproduced this in Geometric Optics also, so it's not sim-specific. @Nancy-Salpepi recalls reporting something similar in a past issue for some other sim. @arouinfar @Nancy-Salpepi and I agreed that this is not blocking for FEL.

@jessegreenberg could you please take a look?

jessegreenberg commented 2 weeks ago

This is happening because we are using CallbackTimer in KeyboardDragListener. We thought CallbackTimer was a good way to support both dragSpeed and dragDelta, but I can see now how CallbackTimer (through using setInterval ) will have frames where the listener is skipped and there is no movement, causing this stutter.

I'll make an issue in scenery to use a step listener instead.

pixelzoom commented 2 weeks ago

On hold until https://github.com/phetsims/scenery/issues/1638 is addressed.

jessegreenberg commented 2 weeks ago

https://github.com/phetsims/scenery/issues/1638 has been reviewed and closed. The behavior in FEL seems smoother to me, @pixelzoom ready to verify and next steps.

pixelzoom commented 2 weeks ago

Thanks @jessegreenberg. Looks good to me on MacBook Pro Intel + Chrome 126.0.6478.62.

@Nancy-Salpepi please verify, close if OK.

Nancy-Salpepi commented 2 weeks ago

Looks great @jessegreenberg! Tested with MacBook Air (m1 chip) macOS 14.5 + safari/chrome.

Closing.

jessegreenberg commented 2 weeks ago

Great - Thanks for finding this @Nancy-Salpepi.