phetsims / circuit-construction-kit-common

"Circuit Construction Kit: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
10 stars 10 forks source link

Overlapping inline ammeter with a circuit element can look odd #978

Closed Nancy-Salpepi closed 1 year ago

Nancy-Salpepi commented 1 year ago

Test device MacBook Air M1 chip

Operating System 13.2.1

Browser Safari

Problem description For https://github.com/phetsims/qa/issues/908, on the lab screen, if I move a circuit element over the inline ammeter, the element goes in front of the meter but behind the current reading, making things looks odd. Once the connection is made, everything looks correct.

This is also seen in published.

Steps to reproduce

  1. Add an inline ammeter to the play area
  2. move a circuit element, ex. a pencil, over the ammeter

Visuals

Screenshot 2023-02-28 at 9 14 24 AM
Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Circuit Construction Kit: DC‬ URL: https://phet-dev.colorado.edu/html/circuit-construction-kit-dc/1.3.0-rc.1/phet/circuit-construction-kit-dc_all_phet.html Version: 1.3.0-rc.1 2023-02-23 22:57:25 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15 Language: en-US Window: 1222x654 Pixel Ratio: 2/1 WebGL: WebGL 1.0 GLSL: WebGL GLSL ES 1.0 (1.0) 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: {}
arouinfar commented 1 year ago

Thanks @Nancy-Salpepi. While it looks weird, I think we've previously decided it was acceptable. The inline ammeter has two layers so that the readout is not occluded by the current representation and it also creates the illusion that the electrons travel through it. The side effect, of course, is that it's possible to sandwich other items in between the ammeter's layers.

That said, if try to attach an overlapping circuit element to the inline ammeter, it will automatically rotate away so that the elements are no longer parallel. There will still be some clipping caused by the top layer of the ammeter, but I think that's okay.

image

An alternative would be to relayer the battery/pencil in the example above to be completely on top of the ammeter's top layer. Similarly, a circuit element that is currently being controlled by the user would be the top-most layer within the circuit, so it could never be dragged in between the ammeter layers. However, I think there might have been other constraints that prevented this, which is why the z-ordering is currently the way it is.

matthew-blackman commented 1 year ago

@arouinfar @samreid and I discussed this, and agree that although it is possible to reassess the z-ordering of connected and disconnected elements, it is beyond the scope of this milestone. The behavior observed above is not ideal, but reworking the z-ordering structure of the sim warrants a more time consuming solution than we feel is needed for this RC. In a prior version, when electrons were on the circuit element, there was a problem created at the joints between objects. We feel that this issue can be closed.