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

meterNode visibleProperty for model and view causing buggy behavior #951

Closed matthew-blackman closed 1 year ago

matthew-blackman commented 1 year ago

For the ammeter and voltmeter nodes, there are two visibleProperties: both view and model.

model visibleProperty: false puts the tool back into the toolbox. visibleProperty: true restores the tool back to its previous position in the play area. This is consistent with other sims.

@arouinfar @samreid and I agree that we should rename this isActiveProperty (follows Projectile Motion and MSAB pattern) and uninstrument the view visibleProperty for meters.

AgustinVallejo commented 1 year ago

Will take a look!

matthew-blackman commented 1 year ago

Note: Review model.meters phet io overrides after this issue is complete. We will want to feature activeProperty on the meters.

matthew-blackman commented 1 year ago

@arouinfar this is ready for us to review in the tree

samreid commented 1 year ago

I reviewed the commits and tested in studio. Everything seems great here. Sounds like @arouinfar and @matthew-blackman may need to check on the tree and possibly phet-io-overrides. Reassigning.

arouinfar commented 1 year ago

Something's not quite right with isActiveProperty. If both voltmeters are active in the play area, the "Voltmeter" label is hidden in the toolbox. This a change from the published version, and looks a bit odd.

Master Latest Published Version
image image

What's stranger is that completely removing all series ammeters leaves behind a ghost, similar to the strategy we employ for carousel. This creates an inconsistent appearance: image

Back to @matthew-blackman.

samreid commented 1 year ago

Before deciding how to proceed for this issue, I'd like to discuss part of the implementation and design. It's nice to reuse the circuit element tool code for the ammeter, but it has the default behavior of leaving behind the ghost. If we liked having the ghost in the carousel, would we also like to have ghosts in the sensor toolbox? I'm not sure what will be easier--unghosting the series ammeter or ghosting the other element. But thought I should ask before starting. Or should we just implement whatever seems easier? Or is it OK that they are inconsistent, because one is a circuit element and the other is not?

It seems in either case we would need to fix the voltmeters text. So perhaps I'll start there.

samreid commented 1 year ago

It was straightforward to zero out the series ammeter ghost transparency. So I did that, and I tried to retain the text when all items are dragged out (but not when tools are made invisible from studio). Most things seem to be good, but there may be a corner case or two that is not consistent? @arouinfar or @matthew-blackman can you please help test?

arouinfar commented 1 year ago

It was straightforward to zero out the series ammeter ghost transparency. So I did that, and I tried to retain the text when all items are dragged out (but not when tools are made invisible from studio).

Great! While the ghosting looks nice for the carousel, it seems odd in the toolbox. Overall, things are looking good.

Most things seem to be good, but there may be a corner case or two that is not consistent?

There's some strange behavior with dynamic layout that I don't love because it exposes resizing panels to the users.

Additionally, using isActiveProperty to remove the voltmeters from the toolbox looks odd. Everything ends up centered in the play area, including the probes.

image

It would be preferable if the probes could look like this:

image
samreid commented 1 year ago

Thanks, I was able to reproduce those 3 errant behaviors and correct them with the commits. Can you please test/verify?

arouinfar commented 1 year ago

Thanks @samreid, looks good!