From 65279cb1f61e4f4444ea7203e6f9d8a16701868d Mon Sep 17 00:00:00 2001 From: SaurabhTotey Date: Mon, 18 May 2020 09:39:45 -0600 Subject: [PATCH] Replaced all position-based usages of 'location' with 'position' See https://github.com/phetsims/phet-info/issues/126 --- .../view/MoleculesAndLightScreenView.js | 14 +++++++------- js/moleculesandlight/view/ObservationWindow.js | 10 +++++----- .../view/PhotonEmissionSoundGenerator.js | 4 ++-- js/moleculesandlight/view/WindowFrameNode.js | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/moleculesandlight/view/MoleculesAndLightScreenView.js b/js/moleculesandlight/view/MoleculesAndLightScreenView.js index da1a6815..db2ea7ed 100644 --- a/js/moleculesandlight/view/MoleculesAndLightScreenView.js +++ b/js/moleculesandlight/view/MoleculesAndLightScreenView.js @@ -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; @@ -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( @@ -283,4 +283,4 @@ inherit( ScreenView, MoleculesAndLightScreenView, { } } ); -export default MoleculesAndLightScreenView; \ No newline at end of file +export default MoleculesAndLightScreenView; diff --git a/js/moleculesandlight/view/ObservationWindow.js b/js/moleculesandlight/view/ObservationWindow.js index 06afc091..32fd876b 100644 --- a/js/moleculesandlight/view/ObservationWindow.js +++ b/js/moleculesandlight/view/ObservationWindow.js @@ -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 @@ -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 ); } @@ -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 ) ); } } @@ -307,4 +307,4 @@ inherit( Rectangle, ObservationWindow, { } } ); -export default ObservationWindow; \ No newline at end of file +export default ObservationWindow; diff --git a/js/moleculesandlight/view/PhotonEmissionSoundGenerator.js b/js/moleculesandlight/view/PhotonEmissionSoundGenerator.js index 376baa6d..823cdafb 100644 --- a/js/moleculesandlight/view/PhotonEmissionSoundGenerator.js +++ b/js/moleculesandlight/view/PhotonEmissionSoundGenerator.js @@ -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 ) { @@ -112,4 +112,4 @@ class PhotonEmissionSoundGenerator extends SoundGenerator { } moleculesAndLight.register( 'PhotonEmissionSoundGenerator', PhotonEmissionSoundGenerator ); -export default PhotonEmissionSoundGenerator; \ No newline at end of file +export default PhotonEmissionSoundGenerator; diff --git a/js/moleculesandlight/view/WindowFrameNode.js b/js/moleculesandlight/view/WindowFrameNode.js index 0e2e7cae..1d863490 100644 --- a/js/moleculesandlight/view/WindowFrameNode.js +++ b/js/moleculesandlight/view/WindowFrameNode.js @@ -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 ) { @@ -209,4 +209,4 @@ inherit( CanvasNode, WindowFrameNode, { } } ); -export default WindowFrameNode; \ No newline at end of file +export default WindowFrameNode;