Skip to content

Commit

Permalink
Add validValues to finalProton and finalMass NumberProperty's. See #112.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisav1 committed Aug 18, 2023
1 parent ea664b6 commit c694d27
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/chart-intro/model/DecayEquationModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import NuclideChartCellModel from './NuclideChartCellModel.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import BANConstants from '../../common/BANConstants.js';
import Utils from '../../../../dot/js/Utils.js';

class DecayEquationModel {

Expand All @@ -25,9 +27,11 @@ class DecayEquationModel {

this.currentCellModelProperty = new Property( this.getCurrentCellModel( cellModelArray, protonCountProperty.value, massNumberProperty.value ) );

// initialize to -1
this.finalProtonNumberProperty = new NumberProperty( -1 );
this.finalMassNumberProperty = new NumberProperty( -1 );
// initialize to 0
this.finalProtonNumberProperty = new NumberProperty( 0,
{ validValues: Utils.rangeInclusive( 0, BANConstants.CHART_MAX_NUMBER_OF_PROTONS ) } );
this.finalMassNumberProperty = new NumberProperty( 0,
{ validValues: Utils.rangeInclusive( 0, BANConstants.CHART_MAX_NUMBER_OF_PROTONS + BANConstants.CHART_MAX_NUMBER_OF_NEUTRONS ) } );

massNumberProperty.link( () => {
const currentCell = this.getCurrentCellModel( cellModelArray, protonCountProperty.value, massNumberProperty.value );
Expand Down

0 comments on commit c694d27

Please sign in to comment.