Skip to content

Commit

Permalink
Convert globals to parameters, see #222
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jun 10, 2023
1 parent 57523e2 commit ce6db2c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion js/common/view/CAVPlotNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default class CAVPlotNode extends Node {
model instanceof MeanAndMedianModel ? model.isTopMeanVisibleProperty :
model instanceof VariabilityModel ? DerivedProperty.valueEqualsConstant( model.selectedVariabilityMeasureProperty, VariabilityMeasure.MAD ) :
new BooleanProperty( true ),
sceneModel.dataRangeProperty, {
sceneModel.dataRangeProperty,
CAVConstants.CHART_VIEW_WIDTH,
CAVConstants.PHYSICAL_RANGE, {
color: 'black',
includeXAxis: true,
includeMeanStroke: false,
Expand Down
4 changes: 3 additions & 1 deletion js/common/view/CAVScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export default class CAVScreenView extends ScreenView {
model.isPlayAreaMeanVisibleProperty,
new DynamicProperty( model.selectedSceneModelProperty, {
derive: 'dataRangeProperty'
} ), {
} ),
CAVConstants.CHART_VIEW_WIDTH,
CAVConstants.PHYSICAL_RANGE, {
includeXAxis: false,
includeRangeOnXAxis: false,
includeMeanStroke: true,
Expand Down
11 changes: 6 additions & 5 deletions js/soccer-common/view/NumberLineNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import CAVColors from '../../common/CAVColors.js';
import Vector2 from '../../../../dot/js/Vector2.js';
import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js';
import CAVConstants from '../../common/CAVConstants.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import Multilink from '../../../../axon/js/Multilink.js';

Expand All @@ -43,6 +42,8 @@ export default class NumberLineNode extends Node {
modelViewTransform: ModelViewTransform2,
isMeanIndicatorVisibleProperty: TReadOnlyProperty<boolean>,
rangeProperty: TReadOnlyProperty<Range | null>,
chartViewWidth: number,
physicalRange: Range,
providedOptions?: NumberLineNodeOptions
) {

Expand All @@ -56,8 +57,8 @@ export default class NumberLineNode extends Node {
const tickMarkExtent = options.includeXAxis ? 7 : 10;

const chartTransform = new ChartTransform( {
viewWidth: CAVConstants.CHART_VIEW_WIDTH,
modelXRange: CAVConstants.PHYSICAL_RANGE,
viewWidth: chartViewWidth,
modelXRange: physicalRange,
viewHeight: tickMarkExtent / 2,
modelYRange: new Range( 0, 1 )
} );
Expand Down Expand Up @@ -117,7 +118,7 @@ export default class NumberLineNode extends Node {
if ( meanValue !== null ) {

// Account for the overall offset of the number line node itself (leftmost tick mark)
const x = modelViewTransform.modelToViewX( meanValue ) - modelViewTransform.modelToViewX( CAVConstants.PHYSICAL_RANGE.min );
const x = modelViewTransform.modelToViewX( meanValue ) - modelViewTransform.modelToViewX( physicalRange.min );
meanIndicatorNode.centerTop = new Vector2( x, 0 );
}
meanIndicatorNode.visible = isMeanIndicatorVisible && meanValue !== null;
Expand All @@ -141,7 +142,7 @@ export default class NumberLineNode extends Node {
return new Path( TRIANGLE_SHAPE, {
fill: CAVColors.meanColorProperty,
stroke: includeStroke ? CAVColors.arrowStrokeProperty : null,
lineWidth: CAVConstants.ARROW_LINE_WIDTH
lineWidth: 0.5
} );
}
}
Expand Down

0 comments on commit ce6db2c

Please sign in to comment.