Skip to content

Commit

Permalink
Update text layout
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Aug 23, 2022
1 parent d6dce89 commit 61b98dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/QuestionBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import Bounds2 from '../../dot/js/Bounds2.js';
import PhetFont from '../../scenery-phet/js/PhetFont.js';
import Tandem from '../../tandem/js/Tandem.js';
import TProperty from '../../axon/js/TProperty.js';
import TReadOnlyProperty from '../../axon/js/TReadOnlyProperty.js';
import Multilink from '../../axon/js/Multilink.js';

type SelfOptions = {
labelText: string;
labelText: string | TReadOnlyProperty<string>;
};
export type QuestionBarOptions = SelfOptions & StrictOmit<StatusBarOptions, 'floatToTop'>;

Expand All @@ -43,10 +45,11 @@ class QuestionBar extends StatusBar {
maxWidth: layoutBounds.width - QUESTION_TEXT_MARGIN * 2,
tandem: options.tandem.createTandem( 'labelText' )
} );

this.addChild( labelText );

this.positioningBoundsProperty.link( bounds2 => {
labelText.centerY = bounds2.centerY;
Multilink.multilink( [ labelText.localBoundsProperty, this.positioningBoundsProperty ], ( localBounds, positioningBounds ) => {
labelText.centerY = positioningBounds.centerY;
labelText.left = QUESTION_TEXT_MARGIN;
} );
}
Expand Down

0 comments on commit 61b98dd

Please sign in to comment.