Skip to content

Commit

Permalink
doc, #78
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 10, 2023
1 parent db905e0 commit 3c26440
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/common/view/ReactionBarNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ export default class ReactionBarNode<R extends Reaction = Reaction> extends Node
barNode.setRect( visibleBounds.left, 0, visibleBounds.width, radioButtonGroup.height + ( 2 * Y_MARGIN ) );
} );

// radio buttons at right, vertically centered in the bar
radioButtonGroup.boundsProperty.link( bounds => {
radioButtonGroup.right = options.layoutBounds.right - X_MARGIN;
radioButtonGroup.centerY = barNode.centerY;
} );

const equationNodes = reactions.map( reaction => {
const visibleProperty = new DerivedProperty( [ reactionProperty ], value => value === reaction );
return createEquationNode( reaction, visibleProperty );
Expand All @@ -77,6 +71,13 @@ export default class ReactionBarNode<R extends Reaction = Reaction> extends Node

super( options );

// radio buttons at right, vertically centered in the bar
radioButtonGroup.boundsProperty.link( bounds => {
radioButtonGroup.right = options.layoutBounds.right - X_MARGIN;
radioButtonGroup.centerY = barNode.centerY;
} );

// equations centered in the space to the left of radio buttons
Multilink.multilink( [ radioButtonGroup.visibleProperty, radioButtonGroup.boundsProperty ],
( radioButtonGroupVisible, radioButtonGroupBounds ) => {
equationNodes.forEach( equationNode => {
Expand Down

0 comments on commit 3c26440

Please sign in to comment.