Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound is missing from RoundToggleButton. #895

Closed
pixelzoom opened this issue Sep 30, 2024 · 3 comments
Closed

Sound is missing from RoundToggleButton. #895

pixelzoom opened this issue Sep 30, 2024 · 3 comments
Assignees
Labels

Comments

@pixelzoom
Copy link
Contributor

Discovered while working on alt input for momentary toggle buttons in #796.

In 1df861f, @samreid added sound to RectangularToggleButton, but did not add sound to RoundToggleButton. I see no reason why the sound should be different because a button is rectangular vs round, so labeling this as a bug.

@pixelzoom
Copy link
Contributor Author

It looks like sun buttons are in the (bad) habit of duplicating sound code in the round vs rectangular versions of buttons. For example, RectangularPushButton and RoundPushButton both contain these duplicated lines of code:

type SelfOptions = {
  soundPlayer?: TSoundPlayer;
};

      soundPlayer: sharedSoundPlayers.get( 'pushButton' ),

    // sound generation
    const playSound = () => { options.soundPlayer.play(); };
    pushButtonModel.produceSoundEmitter.addListener( playSound );

      pushButtonModel.produceSoundEmitter.removeListener( playSound );

Unfortunately, I don't see any easy option but to follow this same pattern of duplication (for now) with RectangularToggleButton and RoundToggleButton.

@jessegreenberg
Copy link
Contributor

Sorry @pixelzoom I am confused, I see sounds in RoundToggleButton here:

valueOffSoundPlayer: sharedSoundPlayers.get( 'toggleOff' ),
valueOnSoundPlayer: sharedSoundPlayers.get( 'toggleOn' ),

Is there a sim or place where this isn't working?

@jessegreenberg jessegreenberg assigned pixelzoom and unassigned samreid Sep 30, 2024
@pixelzoom
Copy link
Contributor Author

Hmm.... My bad. Not sure what I was looking at. I was probably confusing this RectangularStickyToggleButton, which I see @jessegreenberg fixed up in b8622cb on 9/26. Sorry for the bother, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants