Skip to content

Commit

Permalink
Fix range initial checkbox selection, see #170
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed May 10, 2023
1 parent 214a9bf commit 5481698
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions js/variability/view/VariabilityAccordionBox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023, University of Colorado Boulder

import { AlignGroup, Color, Path, Text, VBox } from '../../../../scenery/js/imports.js';
import { AlignGroup, Color, Path, Text, VBox, Node } from '../../../../scenery/js/imports.js';
import CenterAndVariabilityStrings from '../../CenterAndVariabilityStrings.js';
import Bounds2 from '../../../../dot/js/Bounds2.js';
import Tandem from '../../../../tandem/js/Tandem.js';
Expand Down Expand Up @@ -148,16 +148,17 @@ export default class VariabilityAccordionBox extends CAVAccordionBox {
rangeValue => rangeValue === null ? '?' : `${rangeValue}`
);

return new VariabilityReadoutText( rangeReadoutValueProperty,
CenterAndVariabilityStrings.rangeEqualsValuePatternStringProperty, {
fill: CAVColors.meanColorProperty,

// TODO: See https://github.com/phetsims/center-and-variability/issues/170, putting this as the visibleProperty means ToggleNode checks the checkbox when it makes the node visible
visibleProperty: model.isShowingRangeProperty,
left: 0,
centerY: backgroundNode.height / 2,
tandem: tandem.createTandem( 'rangeReadoutText' )
} );
// Nest in a new Node so that ToggleNode has independent control over the visibility
return new Node( {
children: [ new VariabilityReadoutText( rangeReadoutValueProperty,
CenterAndVariabilityStrings.rangeEqualsValuePatternStringProperty, {
fill: CAVColors.meanColorProperty,
visibleProperty: model.isShowingRangeProperty,
left: 0,
centerY: backgroundNode.height / 2,
tandem: tandem.createTandem( 'rangeReadoutText' )
} ) ]
} );
}
}, {
value: VariabilityMeasure.IQR,
Expand Down Expand Up @@ -199,12 +200,15 @@ export default class VariabilityAccordionBox extends CAVAccordionBox {
return madValue ? `${madValue}` : '?';
} );

return new VariabilityReadoutText( madReadoutValueProperty,
CenterAndVariabilityStrings.meanEqualsValuePatternStringProperty, {
fill: CAVColors.meanColorProperty,
visibleProperty: model.isShowingMADProperty
// tandem: options.tandem.createTandem( 'rangeReadoutText' )
} );
// Nest in a new Node so that ToggleNode has independent control over the visibility
return new Node( {
children: [ new VariabilityReadoutText( madReadoutValueProperty,
CenterAndVariabilityStrings.meanEqualsValuePatternStringProperty, {
fill: CAVColors.meanColorProperty,
visibleProperty: model.isShowingMADProperty
// tandem: options.tandem.createTandem( 'rangeReadoutText' )
} ) ]
} );
}
} ]
);
Expand Down

0 comments on commit 5481698

Please sign in to comment.