Skip to content

Commit

Permalink
Move physical range to the call site, see #222
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jun 10, 2023
1 parent fa0b9de commit 3ed870d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/common/view/CAVScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export default class CAVScreenView extends ScreenView {
model,
sceneModel,
( soccerPlayer, sceneModel ) => this.getSoccerPlayerImageSet( soccerPlayer, sceneModel ),
modelViewTransform, {
modelViewTransform,
CAVConstants.PHYSICAL_RANGE, {
tandem: options.tandem.createTandem( `${CAVConstants.SCENE_VIEW_TANDEM}${index + 1}` )
} ) );

Expand Down
5 changes: 3 additions & 2 deletions js/soccer-common/view/SceneView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { Shape } from '../../../../kite/js/imports.js';
import Bounds2 from '../../../../dot/js/Bounds2.js';
import SoccerPlayer from '../model/SoccerPlayer.js';
import MedianHighlightLayer from '../../common/view/MedianHighlightLayer.js';
import CAVConstants from '../../common/CAVConstants.js';
import Property from '../../../../axon/js/Property.js';
import Range from '../../../../dot/js/Range.js';

/**
* Renders view elements for a CAVSceneModel. Note that to satisfy the correct z-ordering, elements
Expand All @@ -38,6 +38,7 @@ export default class SceneView {
public readonly sceneModel: CAVSceneModel,
getSoccerPlayerImageSet: ( soccerPlayer: SoccerPlayer, sceneModel: CAVSceneModel ) => SoccerPlayerImageSet,
modelViewTransform: ModelViewTransform2,
physicalRange: Range,
options: { tandem: Tandem } ) {

const soccerBallMap = new Map<SoccerBall, SoccerBallNode>();
Expand All @@ -62,7 +63,7 @@ export default class SceneView {
model.objectNodesInputEnabledProperty, {
tandem: options.tandem.createTandem( 'soccerBallNodes' ).createTandem( `soccerBallNode${index + 1}` ),
pickable: false,
enabledRangeProperty: new Property( CAVConstants.PHYSICAL_RANGE )
enabledRangeProperty: new Property( physicalRange )
} );

backLayerSoccerBallLayer.addChild( soccerBallNode );
Expand Down

0 comments on commit 3ed870d

Please sign in to comment.