phetsims / sun

User-interface components for PhET simulations, built on top of Scenery.
MIT License
4 stars 12 forks source link

Un-instrument text in `TextPushButton` #850

Closed jbphet closed 11 months ago

jbphet commented 12 months ago

In https://github.com/phetsims/greenhouse-effect/issues/341 I was asked to remove the phet-io instrumentation of the text in a button due to changes in the way instrumentation of text is done. Upon investigation, it looks like the instrumentation of the text is actually in the TextPushButton common code class. There is an existing general issue about removing text instrumentation, see https://github.com/phetsims/phet-io/issues/1952, and I guess this is a specific instance of a case where that change is needed.

Looking at the code in TextPushButton, I think all that needs to happen is that the tandem is removed from the text node. Here's an excerpt:

    const text = new Text( string, combineOptions<TextOptions>( {
      font: options.font,
      fill: options.textFill,
      maxWidth: options.maxTextWidth,
      tandem: options.tandem.createTandem( 'text' )
    }, options.textNodeOptions ) );
jbphet commented 12 months ago

I am reluctant to do this without first consulting with the phet-io team, since I believe this will change the phet-io API for a number of sims, and I'm not sure how we are supposed to handle that.

jbphet commented 11 months ago

@samreid and I reviewed the changes to the code and the API files in a meeting and they have been approved. Closing.