Closed pixelzoom closed 2 years ago
Here's are the UI components whose constructors would need to be modified. I'm not planning to modify sim-specific subclasses, except where noted.
sun:
scenery-phet:
Devs at today's meeting agree! Notes in the dev meeting doc.
Notes in the dev meeting doc:
CM: Please review https://github.com/phetsims/sun/issues/769 and note objections/consensus.
- This seems, really nice. Thanks!
In the above commits, the constructor signature of Checkbox and its subclasses was changed.
In the above commits, the constructor signature of ComboBoxDisplay was changed.
In the above commits, the constructor signature of ThermometerNode was changed.
In the above commits, the constructor signature of TemperatureAndColorSensorNode was changed.
In the above commit, the constructor signature of ZoomButtonGroup was changed.
In the above commits, the constructor signature of Slider was changed.
In the above commits, the constructor signatures of PageControl, BoogleanToggleNode, BooleanRectangularToggleButton, and BooleanRoundToggleButton were changed.
In the above commits, the constructor signatures of RectangularMomentaryButton and RoundMomentaryButton were changed.
In the above commits, the constructor signatures of RectangularStickyToggleButton and RoundStickyToggleButton were changed.
In the above commits, the constructor signatures of RectangularToggleButton and RoundToggleButton were changed.
In the above commits, the constructor signature of ComboBox and its subclasses was changed.
I've completed all of the refactors identified in https://github.com/phetsims/sun/issues/769#issuecomment-1159512550. WebStorm's "Change signature" feature made this really easy. What made it painful and time-consuming was the amount of time it took to run pre-commit hooks.
Slack#dev-public:
PSA: I’ve completed the revisions for constructor signatures that are listed in https://github.com/phetsims/sun/issues/769. In general, the Property associated with a UI component is the first argument, followed by more “verbose” arguments (content node, items, etc.)
Closing.
For UI components that control a Property, I'd like to standardize constructors so that the Property is the first parameter. Some examples:
This would be more consistent with other UI components:
More importantly, I think it would make usage sites read better, expecially where instantiaton of "content" Nodes are inlined. For example, in build-a-nucleus
DecayScreenView
:Before doing anything, I'll bring this up at developer meeting is see if there are objections or other thoughts.