From 6c2c567e15d70118de1c73e66c91c0f57468a61b Mon Sep 17 00:00:00 2001 From: samreid Date: Fri, 26 Feb 2021 07:41:42 -0700 Subject: [PATCH] Apply WebStorm formatting, see https://github.com/phetsims/phet-info/issues/155 --- js/BinPacker.js | 1 + js/Bounds2.js | 21 +++++++++++++++++++++ js/Bounds3.js | 17 +++++++++++++++++ js/Complex.js | 3 +++ js/DelaunayTriangulation.js | 1 + js/Matrix3.js | 7 +++++++ js/Matrix4.js | 4 ++++ js/OpenRangeTests.js | 6 +++--- js/Quaternion.js | 2 ++ js/Range.js | 4 ++++ js/RangeWithValue.js | 1 + js/Vector3.js | 5 ++++- js/Vector4.js | 1 + 13 files changed, 69 insertions(+), 4 deletions(-) diff --git a/js/BinPacker.js b/js/BinPacker.js index 316025c..8fc3ade 100644 --- a/js/BinPacker.js +++ b/js/BinPacker.js @@ -281,6 +281,7 @@ class Bin { return this.bounds.toString() + ( this.isUsed ? ' used' : '' ); } } + BinPacker.Bin = Bin; export default BinPacker; \ No newline at end of file diff --git a/js/Bounds2.js b/js/Bounds2.js index ba87acb..12ad7ef 100644 --- a/js/Bounds2.js +++ b/js/Bounds2.js @@ -59,6 +59,7 @@ class Bounds2 { * @returns {number} */ getWidth() { return this.maxX - this.minX; } + get width() { return this.getWidth(); } /** @@ -68,6 +69,7 @@ class Bounds2 { * @returns {number} */ getHeight() { return this.maxY - this.minY; } + get height() { return this.getHeight(); } /* @@ -88,6 +90,7 @@ class Bounds2 { * @returns {number} */ getX() { return this.minX; } + get x() { return this.getX(); } /** @@ -97,6 +100,7 @@ class Bounds2 { * @returns {number} */ getY() { return this.minY; } + get y() { return this.getY(); } /** @@ -138,6 +142,7 @@ class Bounds2 { * @returns {number} */ getLeft() { return this.minX; } + get left() { return this.minX; } /** @@ -147,6 +152,7 @@ class Bounds2 { * @returns {number} */ getTop() { return this.minY; } + get top() { return this.minY; } /** @@ -156,6 +162,7 @@ class Bounds2 { * @returns {number} */ getRight() { return this.maxX; } + get right() { return this.maxX; } /** @@ -165,6 +172,7 @@ class Bounds2 { * @returns {number} */ getBottom() { return this.maxY; } + get bottom() { return this.maxY; } /** @@ -174,6 +182,7 @@ class Bounds2 { * @returns {number} */ getCenterX() { return ( this.maxX + this.minX ) / 2; } + get centerX() { return this.getCenterX(); } /** @@ -183,6 +192,7 @@ class Bounds2 { * @returns {number} */ getCenterY() { return ( this.maxY + this.minY ) / 2; } + get centerY() { return this.getCenterY(); } /** @@ -192,6 +202,7 @@ class Bounds2 { * @returns {Vector2} */ getLeftTop() { return new dot.Vector2( this.minX, this.minY ); } + get leftTop() { return this.getLeftTop(); } /** @@ -201,6 +212,7 @@ class Bounds2 { * @returns {Vector2} */ getCenterTop() { return new dot.Vector2( this.getCenterX(), this.minY ); } + get centerTop() { return this.getCenterTop(); } /** @@ -210,6 +222,7 @@ class Bounds2 { * @returns {Vector2} */ getRightTop() { return new dot.Vector2( this.maxX, this.minY ); } + get rightTop() { return this.getRightTop(); } /** @@ -219,6 +232,7 @@ class Bounds2 { * @returns {Vector2} */ getLeftCenter() { return new dot.Vector2( this.minX, this.getCenterY() ); } + get leftCenter() { return this.getLeftCenter(); } /** @@ -228,6 +242,7 @@ class Bounds2 { * @returns {Vector2} */ getCenter() { return new dot.Vector2( this.getCenterX(), this.getCenterY() ); } + get center() { return this.getCenter(); } /** @@ -237,6 +252,7 @@ class Bounds2 { * @returns {Vector2} */ getRightCenter() { return new dot.Vector2( this.maxX, this.getCenterY() ); } + get rightCenter() { return this.getRightCenter(); } /** @@ -246,6 +262,7 @@ class Bounds2 { * @returns {Vector2} */ getLeftBottom() { return new dot.Vector2( this.minX, this.maxY ); } + get leftBottom() { return this.getLeftBottom(); } /** @@ -255,6 +272,7 @@ class Bounds2 { * @returns {Vector2} */ getCenterBottom() { return new dot.Vector2( this.getCenterX(), this.maxY ); } + get centerBottom() { return this.getCenterBottom(); } /** @@ -264,6 +282,7 @@ class Bounds2 { * @returns {Vector2} */ getRightBottom() { return new dot.Vector2( this.maxX, this.maxY ); } + get rightBottom() { return this.getRightBottom(); } /** @@ -539,6 +558,7 @@ class Bounds2 { Math.min( this.maxY, bounds.maxY ) ); } + // TODO: difference should be well-defined, but more logic is needed to compute /** @@ -1401,6 +1421,7 @@ class Bounds2 { if ( result.y > this.maxY ) { result.y = this.maxY; } return result; } + /** * Returns a new Bounds2 object, with the familiar rectangle construction with x, y, width, and height. * @public diff --git a/js/Bounds3.js b/js/Bounds3.js index c4d2af2..74c69f1 100644 --- a/js/Bounds3.js +++ b/js/Bounds3.js @@ -64,6 +64,7 @@ class Bounds3 { * @returns {number} */ getWidth() { return this.maxX - this.minX; } + get width() { return this.getWidth(); } /** @@ -73,6 +74,7 @@ class Bounds3 { * @returns {number} */ getHeight() { return this.maxY - this.minY; } + get height() { return this.getHeight(); } /** @@ -82,6 +84,7 @@ class Bounds3 { * @returns {number} */ getDepth() { return this.maxZ - this.minZ; } + get depth() { return this.getDepth(); } /* @@ -102,6 +105,7 @@ class Bounds3 { * @returns {number} */ getX() { return this.minX; } + get x() { return this.getX(); } /** @@ -111,6 +115,7 @@ class Bounds3 { * @returns {number} */ getY() { return this.minY; } + get y() { return this.getY(); } /** @@ -120,6 +125,7 @@ class Bounds3 { * @returns {number} */ getZ() { return this.minZ; } + get z() { return this.getZ(); } /** @@ -177,6 +183,7 @@ class Bounds3 { * @returns {number} */ getLeft() { return this.minX; } + get left() { return this.minX; } /** @@ -186,6 +193,7 @@ class Bounds3 { * @returns {number} */ getTop() { return this.minY; } + get top() { return this.minY; } /** @@ -195,6 +203,7 @@ class Bounds3 { * @returns {number} */ getBack() { return this.minZ; } + get back() { return this.minZ; } /** @@ -204,6 +213,7 @@ class Bounds3 { * @returns {number} */ getRight() { return this.maxX; } + get right() { return this.maxX; } /** @@ -213,6 +223,7 @@ class Bounds3 { * @returns {number} */ getBottom() { return this.maxY; } + get bottom() { return this.maxY; } /** @@ -222,6 +233,7 @@ class Bounds3 { * @returns {number} */ getFront() { return this.maxZ; } + get front() { return this.maxZ; } /** @@ -231,6 +243,7 @@ class Bounds3 { * @returns {number} */ getCenterX() { return ( this.maxX + this.minX ) / 2; } + get centerX() { return this.getCenterX(); } /** @@ -240,6 +253,7 @@ class Bounds3 { * @returns {number} */ getCenterY() { return ( this.maxY + this.minY ) / 2; } + get centerY() { return this.getCenterY(); } /** @@ -249,6 +263,7 @@ class Bounds3 { * @returns {number} */ getCenterZ() { return ( this.maxZ + this.minZ ) / 2; } + get centerZ() { return this.getCenterZ(); } /** @@ -258,6 +273,7 @@ class Bounds3 { * @returns {Vector3} */ getCenter() { return new Vector3( this.getCenterX(), this.getCenterY(), this.getCenterZ() ); } + get center() { return this.getCenter(); } /** @@ -477,6 +493,7 @@ class Bounds3 { Math.min( this.maxZ, bounds.maxZ ) ); } + // TODO: difference should be well-defined, but more logic is needed to compute /** diff --git a/js/Complex.js b/js/Complex.js index 9f773c6..ac0fba9 100644 --- a/js/Complex.js +++ b/js/Complex.js @@ -66,6 +66,7 @@ class Complex { getMagnitude() { return Math.sqrt( this.magnitudeSquared ); } + get magnitude() { return this.getMagnitude(); } @@ -79,6 +80,7 @@ class Complex { getMagnitudeSquared() { return this.real * this.real + this.imaginary * this.imaginary; } + get magnitudeSquared() { return this.getMagnitudeSquared(); } @@ -462,6 +464,7 @@ class Complex { toString() { return 'Complex(' + this.real + ', ' + this.imaginary + ')'; } + /** * Constructs a complex number from just the real part (assuming the imaginary part is 0). * @public diff --git a/js/DelaunayTriangulation.js b/js/DelaunayTriangulation.js index 15f8c55..b37b6c4 100644 --- a/js/DelaunayTriangulation.js +++ b/js/DelaunayTriangulation.js @@ -679,6 +679,7 @@ class DelaunayTriangulation { this.legalizeEdge( triangle2Edge2 ); } } + /** * Comparison for sorting points by y, then by x. * @private diff --git a/js/Matrix3.js b/js/Matrix3.js index a875d36..534a9b2 100644 --- a/js/Matrix3.js +++ b/js/Matrix3.js @@ -207,6 +207,7 @@ class Matrix3 { getDeterminant() { return this.m00() * this.m11() * this.m22() + this.m01() * this.m12() * this.m20() + this.m02() * this.m10() * this.m21() - this.m02() * this.m11() * this.m20() - this.m01() * this.m10() * this.m22() - this.m00() * this.m12() * this.m21(); } + get determinant() { return this.getDeterminant(); } /** @@ -218,6 +219,7 @@ class Matrix3 { getTranslation() { return new Vector2( this.m02(), this.m12() ); } + get translation() { return this.getTranslation(); } /** @@ -231,6 +233,7 @@ class Matrix3 { Math.sqrt( this.m00() * this.m00() + this.m10() * this.m10() ), Math.sqrt( this.m01() * this.m01() + this.m11() * this.m11() ) ); } + get scaleVector() { return this.getScaleVector(); } /** @@ -242,6 +245,7 @@ class Matrix3 { getRotation() { return Math.atan2( this.m10(), this.m00() ); } + get rotation() { return this.getRotation(); } /** @@ -322,6 +326,7 @@ class Matrix3 { // NOTE: the toFixed calls are inlined for performance reasons return 'matrix(' + this.entries[ 0 ].toFixed( 20 ) + ',' + this.entries[ 1 ].toFixed( 20 ) + ',' + this.entries[ 3 ].toFixed( 20 ) + ',' + this.entries[ 4 ].toFixed( 20 ) + ',' + this.entries[ 6 ].toFixed( 20 ) + ',' + this.entries[ 7 ].toFixed( 20 ) + ')'; } + get cssTransform() { return this.getCSSTransform(); } /** @@ -343,6 +348,7 @@ class Matrix3 { return 'matrix(' + toSVGNumber( this.entries[ 0 ] ) + ',' + toSVGNumber( this.entries[ 1 ] ) + ',' + toSVGNumber( this.entries[ 3 ] ) + ',' + toSVGNumber( this.entries[ 4 ] ) + ',' + toSVGNumber( this.entries[ 6 ] ) + ',' + toSVGNumber( this.entries[ 7 ] ) + ')'; } } + get svgTransform() { return this.getSVGTransform(); } /** @@ -369,6 +375,7 @@ class Matrix3 { '-ms-transform-origin': 'top left' // TODO: do we need other platform-specific transform-origin styles? }; } + get cssTransformStyles() { return this.getCSSTransformStyles(); } /** diff --git a/js/Matrix4.js b/js/Matrix4.js index 781546b..7a1d7e7 100644 --- a/js/Matrix4.js +++ b/js/Matrix4.js @@ -335,6 +335,7 @@ class Matrix4 { getTranslation() { return new Vector3( this.m03(), this.m13(), this.m23() ); } + get translation() { return this.getTranslation(); } /** @@ -362,6 +363,7 @@ class Matrix4 { Math.sqrt( m0103 * m0103 + m1113 * m1113 + m2123 * m2123 + m3133 * m3133 ), Math.sqrt( m0203 * m0203 + m1213 * m1213 + m2223 * m2223 + m3233 * m3233 ) ); } + get scaleVector() { return this.getScaleVector(); } /** @@ -393,6 +395,7 @@ class Matrix4 { this.entries[ 14 ].toFixed( 20 ) + ',' + this.entries[ 15 ].toFixed( 20 ) + ')'; } + get cssTransform() { return this.getCSSTransform(); } /** @@ -741,6 +744,7 @@ class Matrix4 { this.m01() * this.m10() * this.m22() * this.m33() + this.m00() * this.m11() * this.m22() * this.m33(); } + get determinant() { return this.getDeterminant(); } /** diff --git a/js/OpenRangeTests.js b/js/OpenRangeTests.js index 9bea5dc..86db3dc 100644 --- a/js/OpenRangeTests.js +++ b/js/OpenRangeTests.js @@ -62,9 +62,9 @@ QUnit.test( 'setter overrides', assert => { QUnit.test( 'assertion failures', assert => { if ( window.assert ) { assert.throws( () => new OpenRange( 1, 10, { - openMin: false, - openMax: false - } ), 'include both min and max throws an error' ); + openMin: false, + openMax: false + } ), 'include both min and max throws an error' ); assert.throws( () => new OpenRange( 1, 1, minHalfOpenOptions ), 'min open range with min === max throws an error' ); assert.throws( () => new OpenRange( 1, 1, maxHalfOpenOptions ), 'max open range with min === max throws an error' ); assert.throws( () => new OpenRange( 1, 1 ), 'full open range with min === max throws an error' ); diff --git a/js/Quaternion.js b/js/Quaternion.js index 0c39f63..ce87904 100644 --- a/js/Quaternion.js +++ b/js/Quaternion.js @@ -140,6 +140,7 @@ class Quaternion { getMagnitude() { return Math.sqrt( this.magnitudeSquared ); } + get magnitude() { return this.getMagnitude(); } @@ -153,6 +154,7 @@ class Quaternion { getMagnitudeSquared() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; } + get magnitudeSquared() { return this.getMagnitudeSquared(); } diff --git a/js/Range.js b/js/Range.js index b4bc1b9..955ae94 100644 --- a/js/Range.js +++ b/js/Range.js @@ -35,6 +35,7 @@ class Range { getMin() { return this._min; } + get min() { return this.getMin(); } @@ -48,6 +49,7 @@ class Range { assert && assert( min <= this._max, 'min must be <= max: ' + min ); this._min = min; } + set min( min ) { this.setMin( min ); } @@ -60,6 +62,7 @@ class Range { getMax() { return this._max; } + get max() { return this.getMax(); } @@ -73,6 +76,7 @@ class Range { assert && assert( this._min <= max, 'max must be >= to min: ' + max ); this._max = max; } + set max( max ) { this.setMax( max ); } diff --git a/js/RangeWithValue.js b/js/RangeWithValue.js index 3cd5014..3521cff 100644 --- a/js/RangeWithValue.js +++ b/js/RangeWithValue.js @@ -36,6 +36,7 @@ class RangeWithValue extends Range { getDefaultValue() { return this._defaultValue; } + get defaultValue() { return this.getDefaultValue(); } diff --git a/js/Vector3.js b/js/Vector3.js index 1a1fcba..9e5e223 100644 --- a/js/Vector3.js +++ b/js/Vector3.js @@ -48,6 +48,7 @@ class Vector3 { getMagnitude() { return Math.sqrt( this.magnitudeSquared ); } + get magnitude() { return this.getMagnitude(); } @@ -61,6 +62,7 @@ class Vector3 { getMagnitudeSquared() { return this.dot( this ); } + get magnitudeSquared() { return this.getMagnitudeSquared(); } @@ -799,6 +801,7 @@ class Vector3 { toStateObject() { return { x: this.x, y: this.y, z: this.z }; } + // static methods /** @@ -825,7 +828,7 @@ class Vector3 { * @returns {Vector3} */ static fromStateObject( stateObject ) { - return new Vector3( stateObject.x, stateObject.y, stateObject.z); + return new Vector3( stateObject.x, stateObject.y, stateObject.z ); } } diff --git a/js/Vector4.js b/js/Vector4.js index 99b6736..01f676e 100644 --- a/js/Vector4.js +++ b/js/Vector4.js @@ -65,6 +65,7 @@ class Vector4 { getMagnitudeSquared() { return this.dot( this ); } + get magnitudeSquared() { return this.getMagnitudeSquared(); }