Skip to content

Commit

Permalink
move tandemNameSuffix: 'Button' to ButtonNode, phetsims/tandem#310
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 28, 2024
1 parent 1b20dd7 commit ecfc3d0
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 21 deletions.
3 changes: 1 addition & 2 deletions js/buttons/BooleanRectangularToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default class BooleanRectangularToggleButton extends RectangularToggleBut

const options = optionize<BooleanRectangularToggleButtonOptions, SelfOptions, RectangularToggleButtonOptions>()( {
content: content,
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

super( booleanProperty, false, true, options );
Expand Down
5 changes: 2 additions & 3 deletions js/buttons/BooleanRoundToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ class BooleanRoundToggleButton extends RoundToggleButton<boolean> {
* @param booleanProperty
* @param trueNode - shown when booleanProperty is true
* @param falseNode - shown when booleanProperty is false
* @param providedOptions?
* @param [providedOptions]
*/
public constructor( booleanProperty: Property<boolean>, trueNode: Node, falseNode: Node,
providedOptions?: BooleanRoundToggleButtonOptions ) {

const options = optionize<BooleanRoundToggleButtonOptions, SelfOptions, RoundToggleButtonOptions>()( {
content: null,
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

const toggleNode = new BooleanToggleNode( booleanProperty, trueNode, falseNode, {
Expand Down
1 change: 1 addition & 0 deletions js/buttons/ButtonNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export default class ButtonNode extends Sizable( Voicing( Node ) ) {
tagName: 'button',

// phet-io
tandemNameSuffix: 'Button',
visiblePropertyOptions: { phetioFeatured: true },
phetioEnabledPropertyInstrumented: true // opt into default PhET-iO instrumented enabledProperty
}, providedOptions );
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RectangularMomentaryButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default class RectangularMomentaryButton<T> extends RectangularButton {
public constructor( property: TProperty<T>, valueOff: T, valueOn: T, providedOptions?: RectangularMomentaryButtonOptions ) {

const options = optionize<RectangularMomentaryButtonOptions, SelfOptions, RectangularButtonOptions>()( {
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

// Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RectangularPushButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default class RectangularPushButton extends RectangularButton {

const options = optionize<RectangularPushButtonOptions, SelfOptions, SuperOptions>()( {
soundPlayer: pushButtonSoundPlayer,
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

// Save the listener and add it after creating the button model. This is done so that
Expand Down
5 changes: 2 additions & 3 deletions js/buttons/RectangularToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class RectangularToggleButton<T> extends RectangularButton {
* @param property - axon Property that can be either valueOff or valueOn
* @param valueOff - value when the button is in the off state
* @param valueOn - value when the button is in the on state
* @param providedOptions?
* @param [providedOptions]
*/
public constructor( property: Property<T>, valueOff: T, valueOn: T, providedOptions?: RectangularButtonOptions ) {

Expand All @@ -48,8 +48,7 @@ export default class RectangularToggleButton<T> extends RectangularButton {

// phet-io support
tandem: Tandem.REQUIRED,
phetioFeatured: true,
tandemNameSuffix: 'Button'
phetioFeatured: true
}, providedOptions );

// Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RoundMomentaryButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default class RoundMomentaryButton<T> extends RoundButton {
public constructor( property: TProperty<T>, valueOff: T, valueOn: T, providedOptions?: RoundMomentaryButtonOptions ) {

const options = optionize<RoundMomentaryButtonOptions, SelfOptions, RoundButtonOptions>()( {
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

// Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RoundPushButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export default class RoundPushButton extends RoundButton {

const options = optionize<RoundPushButtonOptions, SelfOptions, SuperOptions>()( {
soundPlayer: pushButtonSoundPlayer,
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

// Save the listener and add it after creating the button model. This is done so that
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RoundStickyToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export default class RoundStickyToggleButton<T> extends RoundButton {
soundPlayer: pushButtonSoundPlayer,

// RoundButtonOptions
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button'
tandem: Tandem.REQUIRED
}, providedOptions );

// Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
Expand Down
3 changes: 1 addition & 2 deletions js/buttons/RoundToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export default class RoundToggleButton<T> extends RoundButton {

// phet-io support
tandem: Tandem.REQUIRED,
phetioFeatured: true,
tandemNameSuffix: 'Button'
phetioFeatured: true
}, providedOptions );

// Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
Expand Down
1 change: 0 additions & 1 deletion js/buttons/TextPushButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default class TextPushButton extends RectangularPushButton {

// RectangularPushButtonOptions
tandem: Tandem.REQUIRED,
tandemNameSuffix: 'Button',
innerContent: string
}, providedOptions );

Expand Down

0 comments on commit ecfc3d0

Please sign in to comment.