Skip to content

Commit

Permalink
Replaced all position-based usages of 'location' with 'position'
Browse files Browse the repository at this point in the history
  • Loading branch information
SaurabhTotey authored and jessegreenberg committed Apr 21, 2021
1 parent 51fc698 commit 65279cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions js/moleculesandlight/view/MoleculesAndLightScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const spectrumButtonDescriptionString = moleculesAndLightStrings.a11y.spectrumBu
// Model-view transform for intermediate coordinates.
const INTERMEDIATE_RENDERING_SIZE = new Dimension2( 500, 300 );

// Location of the top left corner of the observation window.
const OBSERVATION_WINDOW_LOCATION = new Vector2( 15, 15 );
// Position for the top left corner of the observation window.
const OBSERVATION_WINDOW_POSITION = new Vector2( 15, 15 );

// Corner radius of the observation window.
const CORNER_RADIUS = 7;
Expand Down Expand Up @@ -110,16 +110,16 @@ function MoleculesAndLightScreenView( photonAbsorptionModel, tandem ) {
this.pdomPlayAreaNode.addChild( windowFrameNode );

// Set positions of the observation window and window frame.
this.observationWindow.translate( OBSERVATION_WINDOW_LOCATION );
clipRectangle.translate( OBSERVATION_WINDOW_LOCATION );
windowFrameNode.translate( OBSERVATION_WINDOW_LOCATION );
this.observationWindow.translate( OBSERVATION_WINDOW_POSITION );
clipRectangle.translate( OBSERVATION_WINDOW_POSITION );
windowFrameNode.translate( OBSERVATION_WINDOW_POSITION );

// Create the control panel for photon emission frequency.
const photonEmissionControlPanel = new QuadEmissionFrequencyControlPanel(
photonAbsorptionModel,
tandem.createTandem( 'photonEmissionControlPanel' )
);
photonEmissionControlPanel.leftTop = ( new Vector2( OBSERVATION_WINDOW_LOCATION.x, 350 ) );
photonEmissionControlPanel.leftTop = ( new Vector2( OBSERVATION_WINDOW_POSITION.x, 350 ) );

// Create the molecule control panel
const moleculeControlPanel = new MoleculeSelectionPanel(
Expand Down Expand Up @@ -283,4 +283,4 @@ inherit( ScreenView, MoleculesAndLightScreenView, {
}
} );

export default MoleculesAndLightScreenView;
export default MoleculesAndLightScreenView;
10 changes: 5 additions & 5 deletions js/moleculesandlight/view/ObservationWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ObservationWindow( photonAbsorptionModel, modelViewTransform, tandem )

// Create and add the photon emitter.
const photonEmitterNode = new PhotonEmitterNode( PHOTON_EMITTER_WIDTH, photonAbsorptionModel, tandem.createTandem( 'photonEmitterNode' ) );
photonEmitterNode.rightCenter = ( modelViewTransform.modelToViewPosition( photonAbsorptionModel.getPhotonEmissionLocation().plus( EMITTER_OFFSET ) ) );
photonEmitterNode.rightCenter = ( modelViewTransform.modelToViewPosition( photonAbsorptionModel.getPhotonEmissionPosition().plus( EMITTER_OFFSET ) ) );
photonEmitterLayer.addChild( photonEmitterNode );

// TODO: This clip area has been replaced with a layered rectangle in MoleculesAndLightScreenView because of a
Expand Down Expand Up @@ -179,11 +179,11 @@ function ObservationWindow( photonAbsorptionModel, modelViewTransform, tandem )
const photonPositionObserver = function() {
self.photonCheckBounds();
};
addedPhoton.locationProperty.link( photonPositionObserver );
addedPhoton.positionProperty.link( photonPositionObserver );

photonAbsorptionModel.photons.addItemRemovedListener( function removalListener( removedPhoton ) {
if ( removedPhoton === addedPhoton ) {
addedPhoton.locationProperty.hasListener( photonPositionObserver ) && addedPhoton.locationProperty.unlink( photonPositionObserver );
addedPhoton.positionProperty.hasListener( photonPositionObserver ) && addedPhoton.positionProperty.unlink( photonPositionObserver );
photonLayer.removeChild( photonNode );
photonAbsorptionModel.photons.removeItemRemovedListener( removalListener );
}
Expand Down Expand Up @@ -284,7 +284,7 @@ inherit( Rectangle, ObservationWindow, {

const photonsToRemove = [];
for ( let photon = 0; photon < this.photonAbsorptionModel.photons.length; photon++ ) {
if ( !this.particleRemovalBounds.containsPoint( this.modelViewTransform.modelToViewPosition( this.photonAbsorptionModel.photons.get( photon ).locationProperty.get() ) ) ) {
if ( !this.particleRemovalBounds.containsPoint( this.modelViewTransform.modelToViewPosition( this.photonAbsorptionModel.photons.get( photon ).positionProperty.get() ) ) ) {
photonsToRemove.push( this.photonAbsorptionModel.photons.get( photon ) );
}
}
Expand All @@ -307,4 +307,4 @@ inherit( Rectangle, ObservationWindow, {
}
} );

export default ObservationWindow;
export default ObservationWindow;
4 changes: 2 additions & 2 deletions js/moleculesandlight/view/PhotonEmissionSoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class PhotonEmissionSoundGenerator extends SoundGenerator {

// listen for new photons and play sounds or set them up to be played later when appropriate
photons.addItemAddedListener( photon => {
const photonXPosition = photon.locationProperty.value.x;
const photonXPosition = photon.positionProperty.value.x;

if ( photonXPosition === PLAY_MOLECULE_EMISSION_X_POSITION ) {

Expand All @@ -112,4 +112,4 @@ class PhotonEmissionSoundGenerator extends SoundGenerator {
}

moleculesAndLight.register( 'PhotonEmissionSoundGenerator', PhotonEmissionSoundGenerator );
export default PhotonEmissionSoundGenerator;
export default PhotonEmissionSoundGenerator;
4 changes: 2 additions & 2 deletions js/moleculesandlight/view/WindowFrameNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ inherit( CanvasNode, WindowFrameNode, {
*/
drawFrameCorner: function( corner, radialCenter, context ) {

// Determine the initial and final angles for arc methods based on input location.
// Determine the initial and final angles for arc methods based on input corner.
let initialAngle;
let finalAngle;
switch( corner ) {
Expand Down Expand Up @@ -209,4 +209,4 @@ inherit( CanvasNode, WindowFrameNode, {
}
} );

export default WindowFrameNode;
export default WindowFrameNode;

0 comments on commit 65279cb

Please sign in to comment.