phetsims / sun

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

RoundButton doesn't use PhET dispose pattern #748

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

RoundButton isn't using PhET's dispose convention. It's defining dispose in the constructor. It should be a method that calls this.diposeRoundButton.

    // @public
    this.dispose = () => {
      if ( interactionStateProperty.hasListener( interactionStateListener ) ) {
        interactionStateProperty.unlink( interactionStateListener );
      }

      baseBrighter8.dispose();
      baseBrighter7.dispose();
      baseBrighter3.dispose();
      baseDarker1.dispose();
      baseDarker2.dispose();
      baseDarker4.dispose();
      baseDarker5.dispose();
      baseTransparent.dispose();
    };
pixelzoom commented 2 years ago

The problem was actually in RoundButton.ThreeDAppearanceStrategy. @jbphet please review, OK to close.

jbphet commented 2 years ago

Looks good to me - thanks! Closing.