Skip to content

Commit

Permalink
lint fixes, #115
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jun 10, 2019
1 parent 6f00ec4 commit 72a96e1
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions js/common/model/CollisionDetector.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ define( require => {
updateParticleContainerCollisions() {
let numberOfParticleContainerCollisions = 0;
for ( let i = 0; i < this.particleArrays.length; i++ ) {
numberOfParticleContainerCollisions +=
doParticleContainerCollisions( this.particleArrays[ i ], this.container.bounds, this.container.leftWallVelocity );
numberOfParticleContainerCollisions += doParticleContainerCollisions( this.particleArrays[ i ],
this.container.bounds, this.container.leftWallVelocity );
}
return numberOfParticleContainerCollisions;
}
Expand Down
10 changes: 6 additions & 4 deletions js/common/model/GasPropertiesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ define( require => {
// @private minimum width of the lid, overlaps the left wall, in pm.
this.minLidWidth = this.openingLeftInset + this.wallThickness;

const initialLidWidth = this.widthProperty.value - this.openingRightInset + this.wallThickness;

// @public width of the lid, in pm
this.lidWidthProperty = new NumberProperty( this.widthProperty.value - this.openingRightInset + this.wallThickness, {
this.lidWidthProperty = new NumberProperty( initialLidWidth, {

// range changes dynamically with width of container
isValidValue: value => ( value >= this.minLidWidth && value <= this.getMaxLidWidth() ),
Expand All @@ -62,7 +64,7 @@ define( require => {
// @public {number} desired width of the container, in pm.
// Set this to animate width change with a speed limit. See #90.
this.desiredWidth = this.widthProperty.value;

// @private {number} previous location of the left wall
this.previousLeft = this.left;
}
Expand Down Expand Up @@ -184,7 +186,7 @@ define( require => {
if ( this.lidIsOnProperty.value ) {
openingLeft = this.left - this.wallThickness + this.lidWidthProperty.value;

// Round to the nearest pm to avoid floating-point error, see https://github.com/phetsims/gas-properties/issues/63.
// Round to nearest pm to avoid floating-point error, see https://github.com/phetsims/gas-properties/issues/63
openingLeft = Util.roundSymmetric( openingLeft );
}
else {
Expand All @@ -199,7 +201,7 @@ define( require => {
`\nthis.lidWidthProperty.value=${this.lidWidthProperty.value}` +
`\nthis.openingLeftInset=${this.openingLeftInset}`
);

return openingLeft;
}

Expand Down
2 changes: 1 addition & 1 deletion js/common/model/GasPropertiesModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ define( require => {
const T = this.temperatureModel.computeTemperature(); // temperature has not been updated, so compute it
const P = this.pressureModel.pressureProperty.value / GasPropertiesConstants.PRESSURE_CONVERSION_SCALE;
assert && assert( P !== 0, 'zero pressure not supported' );

return ( N * k * T ) / P;
}

Expand Down
3 changes: 1 addition & 2 deletions js/common/model/PressureGauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@ define( require => {
PressureGauge.Units = new Enumeration( [ 'KILOPASCALS', 'ATMOSPHERES' ] );

return gasProperties.register( 'PressureGauge', PressureGauge );
} );

} );
2 changes: 1 addition & 1 deletion js/common/model/PressureModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ define( require => {
*/
update( dtPressureGauge, numberOfCollisions ) {

// When adding particles to an empty container, don't compute pressure until 1 particle has collided with the container.
// When adding particles to empty container, don't compute pressure until 1 particle has collided with container
if ( !this.updatePressureEnabled && numberOfCollisions > 0 ) {
this.updatePressureEnabled = true;
}
Expand Down
8 changes: 4 additions & 4 deletions js/diffusion/model/DiffusionCollisionDetector.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ define( require => {

// If the divider is in place, treat the 2 sides of the container as 2 separate containers.
const leftWallVelocity = Vector2.ZERO;
numberOfParticleContainerCollisions +=
CollisionDetector.doParticleContainerCollisions( this.particleArrays[ 0 ], this.container.leftBounds, leftWallVelocity );
numberOfParticleContainerCollisions +=
CollisionDetector.doParticleContainerCollisions( this.particleArrays[ 1 ], this.container.rightBounds, leftWallVelocity );
numberOfParticleContainerCollisions += CollisionDetector.doParticleContainerCollisions(
this.particleArrays[ 0 ], this.container.leftBounds, leftWallVelocity );
numberOfParticleContainerCollisions += CollisionDetector.doParticleContainerCollisions(
this.particleArrays[ 1 ], this.container.rightBounds, leftWallVelocity );
}
else {

Expand Down
2 changes: 1 addition & 1 deletion js/energy/view/HistogramNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ define( require => {
top: background.bottom + 5
} ) );

// y-axis label
// y-axis label
const yAxisLabelNode = new Text( yAxisString, _.extend( {}, HISTOGRAM_AXIS_LABEL_OPTIONS, {
rotation: -Math.PI / 2,
maxWidth: 0.9 * background.height,
Expand Down
4 changes: 2 additions & 2 deletions js/ideal/view/AnimatedHeaterCoolerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ define( require => {
const MAX_DELTA_T_N = 20000;

// Mapping of deltaT * N to heat factor.
const TO_HEAT_FACTOR = new LinearFunction( 0, MAX_DELTA_T_N, MIN_HEAT_COOL_FACTOR, 1, true /* clamp */ );
const toHeatFactor = new LinearFunction( 0, MAX_DELTA_T_N, MIN_HEAT_COOL_FACTOR, 1, true /* clamp */ );

// Animations will be controlled by calling step
const STEP_EMITTER = null;
Expand Down Expand Up @@ -110,7 +110,7 @@ define( require => {

// compute heat/cool factor, relative to temperature change and number of particles
const deltaTN = deltaT * numberOfParticles; // deltaT * N
const heatCoolFactor = Util.sign( deltaT ) * TO_HEAT_FACTOR( Math.abs( deltaTN ) );
const heatCoolFactor = Util.sign( deltaT ) * toHeatFactor( Math.abs( deltaTN ) );
assert && assert( heatCoolFactor >= -1 && heatCoolFactor <= 1, `invalid heatCoolFactor: ${heatCoolFactor}` );

// Animation that moves the flame/ice up
Expand Down

0 comments on commit 72a96e1

Please sign in to comment.