Skip to content

Commit

Permalink
Dilate slider track localBounds to prevent layout issues, see #282
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 15, 2017
1 parent a00d608 commit 0af28ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/HSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ define( function( require ) {
tandem: options.tandem.createTandem( 'track' )
} );
this.track.centerX = this.valueToPosition( ( range.max + range.min ) / 2 );
this.addChild( this.track );

// thumb
var thumb = options.thumbNode || new HSliderThumb( this.enabledProperty, {
Expand All @@ -153,6 +152,8 @@ define( function( require ) {
centerLineStroke: options.thumbCenterLineStroke,
tandem: options.tandem.createTandem( 'thumb' )
} );
this.track.localBounds = this.track.localBounds.dilatedX( thumb.width / 2 );
this.addChild( this.track );

// do this outside of options hash, so that it applied to both default and custom thumbs
thumb.centerY = this.track.centerY;
Expand Down

0 comments on commit 0af28ff

Please sign in to comment.