Skip to content

Commit

Permalink
Do not apply max-sizes if size/radius is not specified on rectangular…
Browse files Browse the repository at this point in the history
…/round buttons, see #889
  • Loading branch information
jonathanolson committed Aug 1, 2024
1 parent 43ac9f1 commit d0b47bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions js/buttons/RectangularButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,14 @@ class RectangularButtonNodeConstraint extends LayoutConstraint {
contentProxy.preferredWidth = preferredContentWidth;
contentProxy.preferredHeight = preferredContentHeight;

const contentContainer = this.buttonNode.contentContainer!;
assert && assert( contentContainer );
// Only apply max sizes if a size is specified in the button, see https://github.com/phetsims/sun/issues/889
if ( this.options.size ) {
const contentContainer = this.buttonNode.contentContainer!;
assert && assert( contentContainer );

contentContainer.maxWidth = preferredContentWidth;
contentContainer.maxHeight = preferredContentHeight;
contentContainer.maxWidth = preferredContentWidth;
contentContainer.maxHeight = preferredContentHeight;
}
}

this.isFirstLayout = false;
Expand Down
11 changes: 7 additions & 4 deletions js/buttons/RoundButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,14 @@ class RoundButtonNodeConstraint extends LayoutConstraint {
contentProxy.preferredWidth = preferredContentWidth;
contentProxy.preferredHeight = preferredContentHeight;

const contentContainer = this.buttonNode.contentContainer!;
assert && assert( contentContainer );
// Only apply max sizes if a size is specified in the button, see https://github.com/phetsims/sun/issues/889
if ( this.options.radius !== null ) {
const contentContainer = this.buttonNode.contentContainer!;
assert && assert( contentContainer );

contentContainer.maxWidth = preferredContentWidth;
contentContainer.maxHeight = preferredContentHeight;
contentContainer.maxWidth = preferredContentWidth;
contentContainer.maxHeight = preferredContentHeight;
}
}

this.isFirstLayout = false;
Expand Down

0 comments on commit d0b47bc

Please sign in to comment.