Skip to content

Commit

Permalink
avoid decorator pattern for button, see phetsims/sun#860 and #555
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Aug 19, 2024
1 parent 7a2d7b3 commit 97e80ed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/create/view/CreateScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class CreateScreenView extends RAPScreenView {
);
this.setScreenSummaryContent( this.createScreenSummaryNode );

const lockToggleParent = new Node();
const ratioLockToggleButton = new RectangularToggleButton( model.ratio.lockedProperty, false, true, {
content: new LockNode( model.ratio.lockedProperty, { scale: 0.4 } ),
baseColor: 'white',
Expand All @@ -96,7 +97,8 @@ class CreateScreenView extends RAPScreenView {
font: new PhetFont( 20 ),
leftCenter: ratioLockToggleButton.rightCenter.plusXY( 8, 0 )
} );
ratioLockToggleButton.addChild( ratioLockText );

lockToggleParent.children = [ ratioLockToggleButton, ratioLockText ];

model.ratio.lockedProperty.link( locked => {
ratioLockToggleButton.voicingContextResponse = locked ? RatioAndProportionStrings.a11y.ratioLockToggleContextResponseStringProperty :
Expand Down Expand Up @@ -135,7 +137,7 @@ class CreateScreenView extends RAPScreenView {
this.topScalingUILayerNode.addChild( myChallengeAccordionBox );

// Right above the resetAllButton
this.bottomScalingUILayerNode.insertChild( this.bottomScalingUILayerNode.children.length - 1, ratioLockToggleButton );
this.bottomScalingUILayerNode.insertChild( this.bottomScalingUILayerNode.children.length - 1, lockToggleParent );

// Should be on top. Don't scale it because that messes with the scaling that the list box goes through, and changes
// the dimensions of the scalingUILayerNode to make it too big. Discovered in https://github.com/phetsims/ratio-and-proportion/issues/273
Expand All @@ -147,7 +149,7 @@ class CreateScreenView extends RAPScreenView {
this.tickMarkRangeComboBoxNode,
tickMarkRangeComboBoxParent,
myChallengeAccordionBox,
ratioLockToggleButton
lockToggleParent
] );

this.resetCreateScreenView = () => {
Expand Down

0 comments on commit 97e80ed

Please sign in to comment.