Skip to content

Commit

Permalink
don't link upon each mass number change, just once is fine, #119
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 31, 2023
1 parent 6630386 commit 3069452
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/chart-intro/view/DecayEquationNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class DecayEquationNode extends VBox {
} );

const stableText = new Text( BuildANucleusStrings.stableStringProperty, TEXT_OPTIONS );

// Re-center the stable text at the horizontal center based on the parameter dimension. Do this whenever the
// text changes length due to a language change.
stableText.boundsProperty.link( () => {
stableText.setLayoutOptions( { leftMargin: stableTextCenterXPosition - stableText.width / 2 } );
} );

const mostLikelyDecayText = new Text( BuildANucleusStrings.mostLikelyDecayStringProperty, {
font: BANConstants.LEGEND_FONT,
maxWidth: 150
Expand Down Expand Up @@ -109,12 +116,6 @@ class DecayEquationNode extends VBox {

equationHBox.setChildren( [ stableText ] );
decayLikelihoodPercentText.visible = false;

// Re-center the stable text at the horizontal center based on the parameter dimension. Do this whenever the
// text changes length due to a language change.
stableText.boundsProperty.link( () => {
stableText.setLayoutOptions( { leftMargin: stableTextCenterXPosition - stableText.width / 2 } );
} );
}
else {
// Nuclide cell unstable but with no known decay type so hide the decayLikelihoodPercentText, and show the
Expand Down

0 comments on commit 3069452

Please sign in to comment.