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

Dynamic layout does not reflow correctly when isEditableProperty is toggled for placed circuit elements #926

Closed matthew-blackman closed 1 year ago

matthew-blackman commented 1 year ago

Panel doesn’t re-center in the play area if toggled while the panel is visible.

Test case 1: Create a resistor, set isEditableProperty to false, click on the resistor, while edit panel visible set isEditableProperty to true

Test case 2: Create a resistor, click on resistor, set isEditableProperty to false

Found while working on https://github.com/phetsims/circuit-construction-kit-common/issues/917

samreid commented 1 year ago

@matthew-blackman will take a screenshot and add label: help-wanted

matthew-blackman commented 1 year ago

Test case 1: Create a resistor, set isEditableProperty to false, click on the resistor, while edit panel visible set isEditableProperty to true

Before:

Screen Shot 2023-01-19 at 2 57 53 PM

After:

Screen Shot 2023-01-19 at 2 58 13 PM
matthew-blackman commented 1 year ago

Test case 2: Create a resistor, click on resistor, set isEditableProperty to false

Before:

Screen Shot 2023-01-19 at 2 59 06 PM

After:

Screen Shot 2023-01-19 at 2 59 19 PM
jbphet commented 1 year ago

I added a link that updates the position of the CircuitElementEditContainerNode using the pre-existing updatePosition method, and it seems to work well for keeping the edit box centered. I regression tested this by opening and closing the edit box for a number of different components, and changed their edit-ability in studio.

Assigning to @samreid and @matthew-blackman so that one of them can review.

samreid commented 1 year ago

I tested many different circuit element edit panels (and hiding/showing their contents), and they all centered properly. Good fix @jbphet, thanks!