phetsims / molecule-polarity

"Molecule Polarity" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 6 forks source link

Instrument inputEnabledProperty #101

Closed pixelzoom closed 3 years ago

pixelzoom commented 3 years ago

Related to #85, and after phetsims/scenery#1116 has been completed...

Instrument inputEnabledProperty for the following Nodes:

Discuss the plan for common-code UI components used by this sim:

zepumph commented 3 years ago

https://github.com/phetsims/scenery/issues/1116 is complete and out for review. You can add the following option to instrument inputEnabledProperty for any Node:

inputEnabledPropertyPhetioInstrumented: true

This can be done in your sim for common code components also, but any changes needed inside common code will be done in https://github.com/phetsims/scenery/issues/1158.

pixelzoom commented 3 years ago

Here's a description of the sim-specific inputEnabledProperty elements that were added in the above commits.

The diatomic molecule has only one DragListener (for rotating), so requires only one element:

moleculePolarity.twoAtomsScreen.view.moleculeNode.inputEnabledProperty

The triatomic molecule has a DragListener for each atom and bond, and they can be individually controlled via these elements:

moleculePolarity.threeAtomsScreen.view.moleculeNode.atomANode.inputEnabledProperty
moleculePolarity.threeAtomsScreen.view.moleculeNode.atomBNode.inputEnabledProperty
moleculePolarity.threeAtomsScreen.view.moleculeNode.atomCNode.inputEnabledProperty

moleculePolarity.threeAtomsScreen.view.moleculeNode.bondABNode.inputEnabledProperty
moleculePolarity.threeAtomsScreen.view.moleculeNode.bondsBCNode.inputEnabledProperty

The triatomic molecule also has this element at the top-level. Setting it to false will disable interaction for all child elements of moleculeNode.

moleculePolarity.threeAtomsScreen.view.moleculeNode.inputEnabledProperty

@arouinfar @kathy-phet please review in master. Anything else for sim-specific inputEnabledProperty?

Next we should discuss what needs to be completed for common-code inputEnabledProperty. See list of UI components in https://github.com/phetsims/molecule-polarity/issues/101#issue-830986250.

pixelzoom commented 3 years ago

3/18/21 design meeting: @arouinfar @kathy-phet @pixelzoom

Need to turn off hint arrows for triatomic atoms that are inputEnabledProperty false.

pixelzoom commented 3 years ago

Need to turn off hint arrows for triatomic atoms that are inputEnabledProperty false.

Done in the above commit. This was a little tricky because the visiblity of ech hint arrow involves 3 things: inputEnabledProperty for the molecule, inputEnabledProperty for the atom, and whether the user has changed the molecule.

@arouinfar ready for review.

arouinfar commented 3 years ago

@pixelzoom looks good on the Three Atoms screen, but I think we'll want to do the same for the Two Atoms screen and have moleculePolarity.twoAtomsScreen.view.moleculeNode.hintArrowsNode.visibleProperty listen to moleculePolarity.twoAtomsScreen.view.moleculeNode.inputEnabledProperty.

pixelzoom commented 3 years ago

Ah right, the Two Atoms screen... duh.

Done in https://github.com/phetsims/molecule-polarity/commit/e76c992503bfc7a444945306e6b0edf5c49913cc and https://github.com/phetsims/molecule-polarity/commit/43f497d45dc6e8b95ac34ed52a8a6b13d95500af. Please re-test the Three Atoms screen, because I made some improvements in the implementation there, informed by the Two Atoms implementation.

arouinfar commented 3 years ago

Looks good in master @pixelzoom.