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

Uninstrument Text and RichText #339

Closed arouinfar closed 1 year ago

arouinfar commented 1 year ago

For #323

Issues identified in https://github.com/phetsims/studio/issues/303 lead to a new way to autoselect strings in Studio. As a result, the recommendation in https://github.com/phetsims/phet-io/issues/1941 is that most instances of text do not need to be instrumented.

@pixelzoom subsequently uninstrumented text in other sims like https://github.com/phetsims/molecule-polarity/issues/160 and https://github.com/phetsims/graphing-quadratics/issues/187. Seems like we should do the same in Natural Selection. Do you agree @pixelzoom?

pixelzoom commented 1 year ago

Yes agreed.

pixelzoom commented 1 year ago

In the above commits, I uninstrumented Text (there are no RichText) and updated the API file. The next step will be to add migration rules. Before I do that, I'd like @arouinfar to review in Studio. Please assign back to me after review.

pixelzoom commented 1 year ago

All of these Text elements were apparently instrumented since the most recent (1.4) release, so they were never part of a published API. Therefore no migration rules are needed, as confirmed via the Migration wrapper. Great call on uninstrumenting these @arouinfar. Feel free to close this issue if everything looks good in Studio.

arouinfar commented 1 year ago

Thanks @pixelzoom. I searched for "text" and found a few remaining instances:

Back to you @pixelzoom.

pixelzoom commented 1 year ago

@arouinfar Both of the "text" elements that you've identified above are in common code. view.dialogs.memoryLimitDialog.text is in OopsDialog. generationSpinner.numberDisplay.valueText is in NumberDisplay. If I remove those, it will change the API of all sims, and require migration rules for all sims.

I recommend that we leave this "as is" for Natural Selection. And optionally open issue(s) to uninstrument Text/RichText in common code. @arouinfar thoughts?

pixelzoom commented 1 year ago

... And optionally open issue(s) to uninstrument Text/RichText in common code. ...

See https://github.com/phetsims/phet-io/issues/1952

arouinfar commented 1 year ago

I recommend that we leave this "as is" for Natural Selection. And optionally open issue(s) to uninstrument Text/RichText in common code. @arouinfar thoughts?

Agreed @pixelzoom. Thanks for opening https://github.com/phetsims/phet-io/issues/1952! Closing.

pixelzoom commented 1 year ago

Reopening. Over in https://github.com/phetsims/phet-io/issues/1952, we decided to address the common-code elements that appear in for Natural Selection 1.5:

pixelzoom commented 1 year ago

In the above commits, I uninstrumented RichText in OopsDialog. This was relatively easy because natural-selection-phet-api.json is the only API that contained this element, and it was added since the 1.4 release, so could be removed without a migration rule.

pixelzoom commented 1 year ago

NumberDisplay quickly turned into a big effort. numberDisplay.valueText.stringProperty is missing the string pattern dependency, so there's much more work to be done in NumberDisplay than just uninstrument numberDisplay.valueText -- see https://github.com/phetsims/scenery-phet/issues/812.

So for this sim, I simply uninstrumented generationSpinner.numberDisplay. The Studio tree used to look like this:

screenshot_2680

... and now it looks like this:

screenshot_2681

This seems OK to me for now. There's really no reason to make the numberDisplay invisible (its visibleProperty probably should have been readonly). And all of the info is available elsewhere. And we have not instrumented the other NumberDisplay instance in this sim, whcih would have been populationGraphNode.dataProbeNode.numberDisplay.

@arouinfar Please review. To summarize:

arouinfar commented 1 year ago

Thanks @pixelzoom. The updates and tree structure look great.

I noticed that toggling generationSpinner.visibleProperty can create layout issues.

image

I don't remember seeing this before, but I might of missed it. Not sure if this is related to the changes made to generationSpinner here or if this is entirely unrelated issue.

pixelzoom commented 1 year ago

Unrelated to this issue (I reverted the above changes to confirm) and generationSpinner.visibleProperty has always been writeable. So I created https://github.com/phetsims/natural-selection/issues/347.