Skip to content

Commit

Permalink
Combine ManualConstraint with alignWithPlayAreaNumberLineNode, see #170
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed May 18, 2023
1 parent 1d727a6 commit df0404b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions js/mean-and-median/view/MeanAndMedianScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import centerAndVariability from '../../centerAndVariability.js';
import MeanAndMedianModel from '../model/MeanAndMedianModel.js';
import CAVColors from '../../common/CAVColors.js';
import CenterAndVariabilityStrings from '../../CenterAndVariabilityStrings.js';
import { AlignGroup } from '../../../../scenery/js/imports.js';
import { AlignGroup, ManualConstraint } from '../../../../scenery/js/imports.js';
import Range from '../../../../dot/js/Range.js';
import StrictOmit from '../../../../phet-core/js/types/StrictOmit.js';
import CAVScreenView, { CAVScreenViewOptions } from '../../common/view/CAVScreenView.js';
Expand Down Expand Up @@ -46,7 +46,11 @@ export default class MeanAndMedianScreenView extends CAVScreenView {
this.playAreaNumberLineNode
);
this.setAccordionBox( meanAndMedianAccordionBox );
meanAndMedianAccordionBox.alignWithPlayAreaNumberLineNode( this.playAreaNumberLineNode.globalBounds.x );

// TODO: https://github.com/phetsims/center-and-variability/issues/170 this seems like a misuse of ManualConstraint
ManualConstraint.create( this, [ this.playAreaNumberLineNode, meanAndMedianAccordionBox ], ( playAreaNumberLineNode, meanAndMedianAccordionBox2 ) => {
meanAndMedianAccordionBox.alignWithPlayAreaNumberLineNode( this.playAreaNumberLineNode.globalBounds.x );
} );

const iconGroup = new AlignGroup();
this.setBottomControls( new VerticalCheckboxGroup( [
Expand Down
6 changes: 5 additions & 1 deletion js/variability/view/VariabilityScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export default class VariabilityScreenView extends CAVScreenView {

const variabilityAccordionBox = new VariabilityAccordionBox( model, this.layoutBounds, options.tandem.createTandem( 'accordionBox' ), this.questionBar.bottom + CAVConstants.SCREEN_VIEW_Y_MARGIN );
this.setAccordionBox( variabilityAccordionBox );
variabilityAccordionBox.alignWithPlayAreaNumberLineNode( this.playAreaNumberLineNode.globalBounds.x );

// TODO: https://github.com/phetsims/center-and-variability/issues/170 this seems like a misuse of ManualConstraint
ManualConstraint.create( this, [ this.playAreaNumberLineNode, variabilityAccordionBox ], ( playAreaNumberLineNode, variabilityAccordionBox2 ) => {
variabilityAccordionBox.alignWithPlayAreaNumberLineNode( this.playAreaNumberLineNode.globalBounds.x );
} );

ManualConstraint.create( this, [ variabilityMeasureRadioButtonGroup, this.accordionBox! ],
( variabilityRadioButtonGroupWrapper, accordionBoxWrapper ) => {
Expand Down

0 comments on commit df0404b

Please sign in to comment.