Closed pixelzoom closed 4 years ago
Encapsulated the RadioButtonGroup in a DirectionOfMotionRadioButtonGroup class in the latest commit. How do you feel about the DirectionOfMotion name? I think it only makes sense on the 1D mode, as the masses do move in both directions on 2D mode. Maybe changing DirectionOfMotion to AmplitudeDirection (and all associated names in the same way, 1D and 2D) would be better?
@Hyodar renaming DirectionOfMotion
to AmplitudeDirection
sounds like a good change. And the radio button group would then be AmplitudeDirectionRadioButtonGroup
.
The current implementation of DirectionOfMotionRadioButtonGroup
looks very nice. You might consider renaming horizontalButton
and verticalButton
to something like horizontalButtonDescription
and verticalButtonDescription
. They are not buttons, they are descriptions that RadioButtonGroup will use to instantiate buttons.
Makes sense. Renamed both DirectionOfMotion
to AmplitudeDirection
and the buttons to button descriptors.
@Hyodar are you testing your changes with assertions enabled? There's a bug in AmplitudeDirectionRadioButtonGroup.js (line 45):
45 }, options
46 } );
The options
argument needs to be moved down 1 line:
45 }
46 }, options );
This is causing merge
to fail with this error:
assert.js?bust=1581460495408:22 Uncaught Error: Assertion failed: at least one source expected
at window.assertions.assertFunction (assert.js?bust=1581460495408:22)
at merge (merge.js?bust=1581460495492:30)
at new AmplitudeDirectionRadioButtonGroup (AmplitudeDirectionRadioButtonGroup.js?bust=1581460495492:28)
at new NormalModeSpectrumAccordionBox (NormalModeSpectrumAccordionBox.js?bust=1581460495492:214)
at new OneDimensionScreenView (OneDimensionScreenView.js?bust=1581460495492:87)
at OneDimensionScreen.createView (OneDimensionScreen.js?bust=1581460495492:36)
at OneDimensionScreen.initializeView (Screen.js?bust=1581460495492:266)
at Array.<anonymous> (Sim.js?bust=1581460495492:866)
It's best to always test with query parameter ea
to enable assertions. And run grunt lint
to check with ESlint before pushing changes.
Oh, sorry. My bad. Fixing right away.
No problem! We understand that it takes a little while to get used to PhET processes. And we appreciate your work.
Probably everything fixed by now.
Everything looks great, so I'll close this.
Related to #2 (code review).
This RadioButtonGroup appears in both screens:
The code to create it is duplicated in AmpPhaseAccordionBox and AmpSelectorAccordionBox:
Factor this out and encapsulate in a class that extends
RadioButtonGroup
.