Skip to content

Commit

Permalink
var -> const using eslint auto fix, phetsims/tasks#1012
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Sep 19, 2019
1 parent 9c84170 commit b60e5a3
Show file tree
Hide file tree
Showing 36 changed files with 504 additions and 504 deletions.
4 changes: 2 additions & 2 deletions js/area-builder-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ define( require => {
const areaBuilderTitleString = require( 'string!AREA_BUILDER/area-builder.title' );

// constants
var tandem = Tandem.rootTandem;
const tandem = Tandem.rootTandem;

var simOptions = {
const simOptions = {
credits: {
leadDesign: 'Karina K. R. Hensberry',
softwareDevelopment: 'John Blanco',
Expand Down
2 changes: 1 addition & 1 deletion js/common/AreaBuilderQueryParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( require => {
// modules
const areaBuilder = require( 'AREA_BUILDER/areaBuilder' );

var AreaBuilderQueryParameters = QueryStringMachine.getAll( {
const AreaBuilderQueryParameters = QueryStringMachine.getAll( {

// fill the shape placement boards on the 'Explore' screen during startup, useful for testing
prefillBoards: { type: 'flag' }
Expand Down
2 changes: 1 addition & 1 deletion js/common/AreaBuilderSharedConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define( require => {
const areaBuilder = require( 'AREA_BUILDER/areaBuilder' );
const Bounds2 = require( 'DOT/Bounds2' );

var AreaBuilderSharedConstants = {
const AreaBuilderSharedConstants = {

// layout bounds used throughout the simulation for laying out the screens
LAYOUT_BOUNDS: new Bounds2( 0, 0, 768, 464 ),
Expand Down
22 changes: 11 additions & 11 deletions js/common/model/MovableShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define( require => {
const Vector2 = require( 'DOT/Vector2' );

// constants
var FADE_RATE = 2; // proportion per second
const FADE_RATE = 2; // proportion per second

/**
* @param {Shape} shape
Expand All @@ -28,7 +28,7 @@ define( require => {
* @constructor
*/
function MovableShape( shape, color, initialPosition ) {
var self = this;
const self = this;

// Property that indicates where in model space the upper left corner of this shape is. In general, this should
// not be set directly outside of this type, and should only be manipulated through the methods defined below.
Expand Down Expand Up @@ -79,12 +79,12 @@ define( require => {
if ( !this.userControlledProperty.get() ) {

// perform any animation
var currentPosition = this.positionProperty.get();
var distanceToDestination = currentPosition.distance( this.destination );
const currentPosition = this.positionProperty.get();
const distanceToDestination = currentPosition.distance( this.destination );
if ( distanceToDestination > dt * AreaBuilderSharedConstants.ANIMATION_SPEED ) {
// Move a step toward the destination.
var stepAngle = Math.atan2( this.destination.y - currentPosition.y, this.destination.x - currentPosition.x );
var stepVector = Vector2.createPolar( AreaBuilderSharedConstants.ANIMATION_SPEED * dt, stepAngle );
const stepAngle = Math.atan2( this.destination.y - currentPosition.y, this.destination.x - currentPosition.x );
const stepVector = Vector2.createPolar( AreaBuilderSharedConstants.ANIMATION_SPEED * dt, stepAngle );
this.positionProperty.set( currentPosition.plus( stepVector ) );
}
else if ( this.animatingProperty.get() ) {
Expand Down Expand Up @@ -145,11 +145,11 @@ define( require => {
decomposeIntoSquares: function( squareLength ) {
assert && assert( this.shape.bounds.width % squareLength === 0 && this.shape.bounds.height % squareLength === 0,
'Error: A dimension of this movable shape is not an integer multiple of the provided dimension' );
var shapes = [];
var unitSquareShape = Shape.rect( 0, 0, squareLength, squareLength );
for ( var column = 0; column < this.shape.bounds.width; column += squareLength ) {
for ( var row = 0; row < this.shape.bounds.height; row += squareLength ) {
var constituentShape = new MovableShape( unitSquareShape, this.color, this.positionProperty.initialValue );
const shapes = [];
const unitSquareShape = Shape.rect( 0, 0, squareLength, squareLength );
for ( let column = 0; column < this.shape.bounds.width; column += squareLength ) {
for ( let row = 0; row < this.shape.bounds.height; row += squareLength ) {
const constituentShape = new MovableShape( unitSquareShape, this.color, this.positionProperty.initialValue );
constituentShape.setDestination( this.positionProperty.get().plusXY( column, row ), false );
constituentShape.invisibleWhenStillProperty.set( this.invisibleWhenStillProperty.get() );
shapes.push( constituentShape );
Expand Down
18 changes: 9 additions & 9 deletions js/common/model/PerimeterShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define( require => {
const Vector2 = require( 'DOT/Vector2' );

// constants
var FLOATING_POINT_ERR_TOLERANCE = 1e-6;
const FLOATING_POINT_ERR_TOLERANCE = 1e-6;

// Utility function to compute the unit area of a perimeter shape.
function calculateUnitArea( shape, unitLength ) {
Expand All @@ -31,10 +31,10 @@ define( require => {
);

// Compute the unit area by testing whether or not points on a sub-grid are contained in the shape.
var unitArea = 0;
var testPoint = new Vector2( 0, 0 );
for ( var row = 0; row * unitLength < shape.bounds.height; row++ ) {
for ( var column = 0; column * unitLength < shape.bounds.width; column++ ) {
let unitArea = 0;
const testPoint = new Vector2( 0, 0 );
for ( let row = 0; row * unitLength < shape.bounds.height; row++ ) {
for ( let column = 0; column * unitLength < shape.bounds.width; column++ ) {
// Scan four points in the unit square. This allows support for triangular 1/2 unit square shapes. This is
// in-lined rather than looped for the sake of efficiency, since this approach avoids vector allocations.
testPoint.setXY( shape.bounds.minX + ( column + 0.25 ) * unitLength, shape.bounds.minY + ( row + 0.5 ) * unitLength );
Expand Down Expand Up @@ -69,8 +69,8 @@ define( require => {
* @constructor
*/
function PerimeterShape( exteriorPerimeters, interiorPerimeters, unitLength, options ) {
var self = this;
var i;
const self = this;
let i;

options = _.extend( {
fillColor: null,
Expand Down Expand Up @@ -125,8 +125,8 @@ define( require => {

// Returns a linearly translated version of this perimeter shape.
translated: function( x, y ) {
var exteriorPerimeters = [];
var interiorPerimeters = [];
const exteriorPerimeters = [];
const interiorPerimeters = [];
this.exteriorPerimeters.forEach( function( exteriorPerimeter, index ) {
exteriorPerimeters.push( [] );
exteriorPerimeter.forEach( function( point ) {
Expand Down
Loading

0 comments on commit b60e5a3

Please sign in to comment.