phetsims / natural-selection

"Natural Selection" is an educational simulation in HTML5, by PhET Interactive Simulations
GNU General Public License v3.0
3 stars 7 forks source link

Duplication of buttons #321

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

Noted while investigating #320 ...

AddAMateButton, PlayButton, and StartOverButton are 99% identical. Their only difference is in the string label. Factor out duplication, and possibly delete these classes.

pixelzoom commented 2 years ago

Done in the above commits.

In preparation for #319 (dynamic locale), this change also instruments the labels (Text nodes) on these buttons. So these PhET-iO elements are new:

naturalSelection.introScreen.view.environmentPanel.playButtonGroup.addAMateButton.textNode
naturalSelection.introScreen.view.environmentPanel.playButtonGroup.addAMateButton.textNode.textProperty
naturalSelection.introScreen.view.environmentPanel.playButtonGroup.playButton.textNode
naturalSelection.introScreen.view.environmentPanel.playButtonGroup.playButton.textNode.textProperty
naturalSelection.introScreen.view.environmentPanel.playButtonGroup.startOverButton.textNode
naturalSelection.introScreen.view.environmentPanel.playButtonGroup.startOverButton.textNode.textProperty

naturalSelection.labScreen.view.environmentPanel.playButtonGroup.addAMateButton.textNode
naturalSelection.labScreen.view.environmentPanel.playButtonGroup.addAMateButton.textNode.textProperty
naturalSelection.labScreen.view.environmentPanel.playButtonGroup.playButton.textNode
naturalSelection.labScreen.view.environmentPanel.playButtonGroup.playButton.textNode.textProperty
naturalSelection.labScreen.view.environmentPanel.playButtonGroup.startOverButton.textNode
naturalSelection.labScreen.view.environmentPanel.playButtonGroup.startOverButton.textNode.textProperty

By default these elements are phetioFeatured: false. Over to @amanda-phet to approve that, or make changes to overrides.js if she wants them to be featured.

amanda-phet commented 2 years ago

I don't think these need to be featured, so this looks good to me.

pixelzoom commented 2 years ago

👍🏻 closing.