From eead4e7d35b133127ad7b11c6562846586f2b79b Mon Sep 17 00:00:00 2001 From: samreid Date: Fri, 26 Feb 2021 07:39:27 -0700 Subject: [PATCH] Apply WebStorm formatting, see https://github.com/phetsims/phet-info/issues/155 --- .../model/BalloonModel.js | 2 +- .../model/SweaterModel.js | 4 +- .../view/BalloonRubbingSoundGenerator.js | 2 +- .../view/BalloonVelocitySoundGenerator.js | 50 +++++++++---------- .../view/WallNode.js | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/js/balloons-and-static-electricity/model/BalloonModel.js b/js/balloons-and-static-electricity/model/BalloonModel.js index 8e4bcdca..2dec25e5 100644 --- a/js/balloons-and-static-electricity/model/BalloonModel.js +++ b/js/balloons-and-static-electricity/model/BalloonModel.js @@ -306,7 +306,7 @@ class BalloonModel { this.isDraggedProperty.lazyLink( isDragged => { // When the user starts dragging a balloon, set its non-dragging velocity to zero. - if ( isDragged ){ + if ( isDragged ) { this.velocityProperty.set( Vector2.ZERO ); } diff --git a/js/balloons-and-static-electricity/model/SweaterModel.js b/js/balloons-and-static-electricity/model/SweaterModel.js index ea54937f..c26cc268 100644 --- a/js/balloons-and-static-electricity/model/SweaterModel.js +++ b/js/balloons-and-static-electricity/model/SweaterModel.js @@ -150,8 +150,8 @@ class SweaterModel { this.plusCharges = []; this.minusCharges = []; - const plusChargesGroupTandem = tandem.createTandem('plusCharges').createGroupTandem( 'plusCharge' ); - const minusChargesGroupTandem = tandem.createTandem('minusCharges').createGroupTandem( 'minusCharge' ); + const plusChargesGroupTandem = tandem.createTandem( 'plusCharges' ).createGroupTandem( 'plusCharge' ); + const minusChargesGroupTandem = tandem.createTandem( 'minusCharges' ).createGroupTandem( 'minusCharge' ); CHARGE_PAIR_POSITIONS.forEach( chargePairPosition => { const plusCharge = new PointChargeModel( chargePairPosition.x, diff --git a/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js b/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js index e624e26a..7e5044d0 100644 --- a/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js +++ b/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js @@ -72,7 +72,7 @@ class BalloonRubbingSoundGenerator extends NoiseGenerator { Property.multilink( [ smoothedSpeedProperty, onSweaterProperty, touchingWallProperty ], ( smoothedDragSpeed, onSweater, touchingWall ) => { - if ( smoothedDragSpeed > 0 && ( onSweater || touchingWall ) ){ + if ( smoothedDragSpeed > 0 && ( onSweater || touchingWall ) ) { // Start the production of the sound if needed. if ( !this.isPlaying ) { diff --git a/js/balloons-and-static-electricity/view/BalloonVelocitySoundGenerator.js b/js/balloons-and-static-electricity/view/BalloonVelocitySoundGenerator.js index ddb6dd74..9a80a606 100644 --- a/js/balloons-and-static-electricity/view/BalloonVelocitySoundGenerator.js +++ b/js/balloons-and-static-electricity/view/BalloonVelocitySoundGenerator.js @@ -58,32 +58,32 @@ class BalloonVelocitySoundGenerator extends SoundClip { const outputUpdaterMultilink = Property.multilink( [ balloonVelocityProperty, touchingWallProperty ], ( balloonVelocity, onSweater, touchingWall ) => { - const speed = balloonVelocity.magnitude; - if ( speed > 0 && !touchingWall ) { - if ( !this.isPlaying ) { - - // Before starting playback, set the playback rate immediately, otherwise there can be a bit of the "chirp" - // sound. - this.setPlaybackRate( mapSpeedToPlaybackRate( speed, 0 ) ); - - // Start the sound playing. - this.play(); + const speed = balloonVelocity.magnitude; + if ( speed > 0 && !touchingWall ) { + if ( !this.isPlaying ) { + + // Before starting playback, set the playback rate immediately, otherwise there can be a bit of the "chirp" + // sound. + this.setPlaybackRate( mapSpeedToPlaybackRate( speed, 0 ) ); + + // Start the sound playing. + this.play(); + } + else { + + // Set the playback rate. This will use the nominal time constant, which should lead to a reasonably smooth + // transition of the rate as the velocity changes. + this.setPlaybackRate( mapSpeedToPlaybackRate( speed ) ); + } + + // Set the output level based on the velocity. + this.setOutputLevel( mapSpeedToOutputLevel( speed, 0.1 ) * options.maxOutputLevel ); } - else{ - - // Set the playback rate. This will use the nominal time constant, which should lead to a reasonably smooth - // transition of the rate as the velocity changes. - this.setPlaybackRate( mapSpeedToPlaybackRate( speed ) ); + else if ( ( speed === 0 || touchingWall ) && this.isPlaying ) { + this.stop(); + this.setOutputLevel( 0 ); } - - // Set the output level based on the velocity. - this.setOutputLevel( mapSpeedToOutputLevel( speed, 0.1 ) * options.maxOutputLevel ); - } - else if ( ( speed === 0 || touchingWall ) && this.isPlaying ) { - this.stop(); - this.setOutputLevel( 0 ); - } - } ); + } ); this.disposeBalloonVelocitySoundGenerator = () => { outputUpdaterMultilink.dispose(); @@ -94,7 +94,7 @@ class BalloonVelocitySoundGenerator extends SoundClip { * release memory references * @public */ - dispose(){ + dispose() { this.disposeBalloonVelocitySoundGenerator(); super.dispose(); } diff --git a/js/balloons-and-static-electricity/view/WallNode.js b/js/balloons-and-static-electricity/view/WallNode.js index bdb4be5f..508baa53 100644 --- a/js/balloons-and-static-electricity/view/WallNode.js +++ b/js/balloons-and-static-electricity/view/WallNode.js @@ -87,7 +87,7 @@ class WallNode extends Node { const maxDeflectedXPosition = 739; // empirically determined _.times( model.wall.numY, index => { - if ( index % 3 === 0 ){ + if ( index % 3 === 0 ) { const xPositionProperty = new DerivedProperty( [ model.wall.minusCharges[ index ].positionProperty ], positionVector => positionVector.x