Skip to content

Commit

Permalink
Apply WebStorm formatting, see phetsims/phet-info#155
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 26, 2021
1 parent 7987360 commit 3882302
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions js/buoyancy/model/BuoyancyIntroModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BuoyancyIntroModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mod
*/
constructor( tandem ) {
const createMasses = ( model, mode ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SAME_MASS:
return [
Cuboid.createWithMass( model.engine, Material.WOOD, Vector2.ZERO, 5 ),
Expand All @@ -51,7 +51,7 @@ class BuoyancyIntroModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mod
};

const positionMasses = ( model, mode, masses ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SAME_MASS:
model.positionMassesLeft( [ masses[ 0 ] ] );
model.positionMassesRight( [ masses[ 1 ] ] );
Expand Down
6 changes: 4 additions & 2 deletions js/common/view/DebugView.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class DebugView extends Node {
const multiplier = Math.pow( mass.displacementVolumeProperty.value / 0.001, 1 / 3 );
poolShape = poolShape.shapeDifference( mass.basin.oneLiterShape.transformed( Matrix3.scaling( multiplier ) ).transformed( mass.matrix ) );
}
} catch ( e ) {
}
catch( e ) {
console.log( e );
}
} );
Expand Down Expand Up @@ -263,7 +264,8 @@ class DebugMassNode extends Node {
const otherShape = otherMass.shapeProperty.value.transformed( otherMass.matrix ).transformed( invertedMatrix );
waterShape = waterShape.shapeDifference( otherShape );
}
} catch ( e ) {
}
catch( e ) {
console.log( e );
}
} );
Expand Down
4 changes: 2 additions & 2 deletions js/density/model/DensityCompareModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DensityCompareModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mo
*/
constructor( tandem ) {
const createMasses = ( model, mode ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SAME_MASS:
return [
Cuboid.createWithMass( model.engine, Material.createCustomMaterial( {
Expand Down Expand Up @@ -101,7 +101,7 @@ class DensityCompareModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mo
};

const positionMasses = ( model, mode, masses ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SAME_MASS:
model.positionMassesLeft( [ masses[ 0 ], masses[ 1 ] ] );
model.positionMassesRight( [ masses[ 2 ], masses[ 3 ] ] );
Expand Down
47 changes: 23 additions & 24 deletions js/density/model/DensityMysteryModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DensityMysteryModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mo
constructor( tandem ) {

const createMasses = ( model, mode ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SET_1:
return [
Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( {
Expand Down Expand Up @@ -149,35 +149,34 @@ class DensityMysteryModel extends DensityBuoyancyModal( DensityBuoyancyModel, Mo
customColor: DensityBuoyancyCommonColorProfile.mysteryMaroonProperty
} ), Vector2.ZERO, 2.85, { tag: Mass.MassTag.THREE_A } )
];
case Mode.RANDOM:
{
const densities = dotRandom.shuffle( randomMaterials ).slice( 0, 5 ).map( material => material.density );
const colors = dotRandom.shuffle( randomColors ).slice( 0, 5 );
const volumes = [
...dotRandom.shuffle( [ 1, 2, 3, 4, 5, 6 ].map( n => n / 1000 ) ).slice( 0, 3 ),
...dotRandom.shuffle( [ 7, 8, 9, 10 ].map( n => n / 1000 ) ).slice( 0, 2 )
].sort();

const tags = [
Mass.MassTag.C,
Mass.MassTag.D,
Mass.MassTag.E,
Mass.MassTag.A,
Mass.MassTag.B
];

return _.sortBy( _.range( 0, 5 ).map( i => Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( {
density: densities[ i ],
customColor: colors[ i ]
} ), Vector2.ZERO, volumes[ i ], { tag: tags[ i ] } ) ), mass => mass.volumeProperty.value );
}
case Mode.RANDOM: {
const densities = dotRandom.shuffle( randomMaterials ).slice( 0, 5 ).map( material => material.density );
const colors = dotRandom.shuffle( randomColors ).slice( 0, 5 );
const volumes = [
...dotRandom.shuffle( [ 1, 2, 3, 4, 5, 6 ].map( n => n / 1000 ) ).slice( 0, 3 ),
...dotRandom.shuffle( [ 7, 8, 9, 10 ].map( n => n / 1000 ) ).slice( 0, 2 )
].sort();

const tags = [
Mass.MassTag.C,
Mass.MassTag.D,
Mass.MassTag.E,
Mass.MassTag.A,
Mass.MassTag.B
];

return _.sortBy( _.range( 0, 5 ).map( i => Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( {
density: densities[ i ],
customColor: colors[ i ]
} ), Vector2.ZERO, volumes[ i ], { tag: tags[ i ] } ) ), mass => mass.volumeProperty.value );
}
default:
throw new Error( `unknown mode: ${mode}` );
}
};

const positionMasses = ( model, mode, masses ) => {
switch ( mode ) {
switch( mode ) {
case Mode.SET_1:
model.positionStackLeft( [ masses[ 1 ], masses[ 4 ] ] );
model.positionStackRight( [ masses[ 2 ], masses[ 3 ], masses[ 0 ] ] );
Expand Down

0 comments on commit 3882302

Please sign in to comment.