Skip to content

Commit

Permalink
Ignore the numberDisplay maxWidth for sizing the arrow buttons, see #513
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Aug 6, 2019
1 parent 199ecaa commit dfce914
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/NumberControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,14 @@ define( require => {
tandem: options.tandem.createTandem( 'rightArrowButton' )
}, options.arrowButtonOptions ) );

// By default, scale the ArrowButtons to have the same height as the NumberDisplay.
// By default, scale the ArrowButtons to have the same height as the NumberDisplay, but ignoring
// the NumberDisplay's maxWidth (if any)
if ( !arrowButtonScaleProvided ) {

// Remove the current button scaling so we can determine the desired final scale factor
leftArrowButton.setScaleMagnitude( 1 );
const arrowButtonsScale = numberDisplay.height / leftArrowButton.height;
const numberDisplayHeight = numberDisplay.localBounds.height; // ignores maxWidth, if any
const arrowButtonsScale = numberDisplayHeight / leftArrowButton.height;

leftArrowButton.setScaleMagnitude( arrowButtonsScale );
rightArrowButton.setScaleMagnitude( arrowButtonsScale );
Expand Down

0 comments on commit dfce914

Please sign in to comment.