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 Dec 15, 2021
1 parent 08edf24 commit b524092
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions js/nodes/Paintable.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ define( require => {
const Renderer = require( 'SCENERY/display/Renderer' );
const scenery = require( 'SCENERY/scenery' );

var isSafari5 = platform.safari5;
var isIE9 = platform.ie9;
const isSafari5 = platform.safari5;
const isIE9 = platform.ie9;

var PAINTABLE_OPTION_KEYS = [
const PAINTABLE_OPTION_KEYS = [
'fill', // {PaintDef} - Sets the fill of this node, see setFill() for documentation.
'fillPickable', // {boolean} - Sets whether the filled area of the node will be treated as 'inside'. See setFillPickable()
'stroke', // {PaintDef} - Sets the stroke of this node, see setStroke() for documentation.
Expand All @@ -38,7 +38,7 @@ define( require => {
'cachedPaints' // {Array.<PaintDef>} - Sets which paints should be cached, even if not displayed. See setCachedPaints()
];

var DEFAULT_OPTIONS = {
const DEFAULT_OPTIONS = {
fill: null,
fillPickable: true,
stroke: null,
Expand All @@ -52,7 +52,7 @@ define( require => {
miterLimit: LineStyles.DEFAULT_OPTIONS.miterLimit
};

var Paintable = {
const Paintable = {
/**
* Applies the trait to a subtype of Node.
* @public
Expand All @@ -63,7 +63,7 @@ define( require => {
mixInto: function( type ) {
assert && assert( _.includes( inheritance( type ), Node ), 'Only Node subtypes should mix Paintable' );

var proto = type.prototype;
const proto = type.prototype;

/**
* These properties and methods are put directly on the prototype of things that have Paintable mixed in.
Expand Down Expand Up @@ -163,7 +163,7 @@ define( require => {
* @returns {null|string|Color|LinearGradient|RadialGradient|Pattern}
*/
getFillValue: function() {
var fill = this.getFill();
let fill = this.getFill();

// Property lookup
if ( fill instanceof Property ) {
Expand Down Expand Up @@ -249,7 +249,7 @@ define( require => {
* @returns {null|string|Color|LinearGradient|RadialGradient|Pattern}
*/
getStrokeValue: function() {
var stroke = this.getStroke();
let stroke = this.getStroke();

// Property lookup
if ( stroke instanceof Property ) {
Expand Down Expand Up @@ -337,8 +337,8 @@ define( require => {
this._lineDrawingStyles.lineWidth = lineWidth;
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineWidth();
}
}
Expand Down Expand Up @@ -375,8 +375,8 @@ define( require => {
this._lineDrawingStyles.lineCap = lineCap;
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineOptions();
}
}
Expand Down Expand Up @@ -414,8 +414,8 @@ define( require => {
this._lineDrawingStyles.lineJoin = lineJoin;
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineOptions();
}
}
Expand Down Expand Up @@ -449,8 +449,8 @@ define( require => {
this._lineDrawingStyles.miterLimit = miterLimit;
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineOptions();
}
}
Expand Down Expand Up @@ -485,8 +485,8 @@ define( require => {
this._lineDrawingStyles.lineDash = lineDash || [];
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineOptions();
}
}
Expand Down Expand Up @@ -530,8 +530,8 @@ define( require => {
this._lineDrawingStyles.lineDashOffset = lineDashOffset;
this.invalidateStroke();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyLineOptions();
}
}
Expand Down Expand Up @@ -594,8 +594,8 @@ define( require => {
setCachedPaints: function( paints ) {
this._cachedPaints = paints.filter( function( paint ) { return paint && paint.isPaint; } );

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyCachedPaints();
}

Expand Down Expand Up @@ -630,8 +630,8 @@ define( require => {
if ( paint && paint.isPaint ) {
this._cachedPaints.push( paint );

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyCachedPaints();
}
}
Expand All @@ -654,8 +654,8 @@ define( require => {

arrayRemove( this._cachedPaints, paint );

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyCachedPaints();
}
}
Expand All @@ -668,7 +668,7 @@ define( require => {
* @param {CanvasContextWrapper} wrapper
*/
beforeCanvasFill: function( wrapper ) {
var fillValue = this.getFillValue();
const fillValue = this.getFillValue();

wrapper.setFillStyle( fillValue );
if ( fillValue.transformMatrix ) {
Expand All @@ -684,7 +684,7 @@ define( require => {
* @param {CanvasContextWrapper} wrapper
*/
afterCanvasFill: function( wrapper ) {
var fillValue = this.getFillValue();
const fillValue = this.getFillValue();

if ( fillValue.transformMatrix ) {
wrapper.context.restore();
Expand All @@ -698,7 +698,7 @@ define( require => {
* @param {CanvasContextWrapper} wrapper
*/
beforeCanvasStroke: function( wrapper ) {
var strokeValue = this.getStrokeValue();
const strokeValue = this.getStrokeValue();

// TODO: is there a better way of not calling so many things on each stroke?
wrapper.setStrokeStyle( this._stroke );
Expand All @@ -721,7 +721,7 @@ define( require => {
* @param {CanvasContextWrapper} wrapper
*/
afterCanvasStroke: function( wrapper ) {
var strokeValue = this.getStrokeValue();
const strokeValue = this.getStrokeValue();

if ( strokeValue.transformMatrix ) {
wrapper.context.restore();
Expand All @@ -735,7 +735,7 @@ define( require => {
* @returns {string}
*/
getCSSFill: function() {
var fillValue = this.getFillValue();
const fillValue = this.getFillValue();
// if it's a Color object, get the corresponding CSS
// 'transparent' will make us invisible if the fill is null
return fillValue ? ( fillValue.toCSS ? fillValue.toCSS() : fillValue ) : 'transparent';
Expand All @@ -748,7 +748,7 @@ define( require => {
* @returns {string}
*/
getSimpleCSSStroke: function() {
var strokeValue = this.getStrokeValue();
const strokeValue = this.getStrokeValue();
// if it's a Color object, get the corresponding CSS
// 'transparent' will make us invisible if the fill is null
return strokeValue ? ( strokeValue.toCSS ? strokeValue.toCSS() : strokeValue ) : 'transparent';
Expand Down Expand Up @@ -789,7 +789,7 @@ define( require => {
* @returns {string}
*/
appendStrokablePropString: function( spaces, result ) {
var self = this;
const self = this;

function addProp( key, value, nowrap ) {
if ( result ) {
Expand All @@ -804,7 +804,7 @@ define( require => {
}

if ( this._stroke ) {
var defaultStyles = new LineStyles();
const defaultStyles = new LineStyles();
if ( typeof this.getStrokeValue() === 'string' ) {
addProp( 'stroke', this.getStrokeValue() );
}
Expand Down Expand Up @@ -837,7 +837,7 @@ define( require => {
* @returns {number} - Renderer bitmask, see Renderer for details
*/
getFillRendererBitmask: function() {
var bitmask = 0;
let bitmask = 0;

// Safari 5 has buggy issues with SVG gradients
if ( !( isSafari5 && this._fill && this._fill.isGradient ) ) {
Expand Down Expand Up @@ -878,7 +878,7 @@ define( require => {
* @returns {number} - Renderer bitmask, see Renderer for details
*/
getStrokeRendererBitmask: function() {
var bitmask = 0;
let bitmask = 0;

// IE9 has bad dashed strokes, let's force a different renderer in case
if ( !( isIE9 && this.hasStroke() && this.hasLineDash() ) ) {
Expand Down Expand Up @@ -906,15 +906,15 @@ define( require => {
function invalidateFill() {
this.invalidateSupportedRenderers();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyFill();
}
}

// Patch in a sub-type call if it already exists on the prototype
if ( proto.invalidateFill ) {
var subtypeInvalidateFill = proto.invalidateFill;
const subtypeInvalidateFill = proto.invalidateFill;
proto.invalidateFill = function() {
subtypeInvalidateFill.call( this );
invalidateFill.call( this );
Expand All @@ -932,15 +932,15 @@ define( require => {
function invalidateStroke() {
this.invalidateSupportedRenderers();

var stateLen = this._drawables.length;
for ( var i = 0; i < stateLen; i++ ) {
const stateLen = this._drawables.length;
for ( let i = 0; i < stateLen; i++ ) {
this._drawables[ i ].markDirtyStroke();
}
}

// Patch in a sub-type call if it already exists on the prototype
if ( proto.invalidateStroke ) {
var subtypeInvalidateStroke = proto.invalidateStroke;
const subtypeInvalidateStroke = proto.invalidateStroke;
proto.invalidateStroke = function() {
subtypeInvalidateStroke.call( this );
invalidateStroke.call( this );
Expand Down

0 comments on commit b524092

Please sign in to comment.