Line.normalX and Line.normalY contain the x and y components of the left-hand normal of the line.
Line.fromAngle will sets this line to start at the given `x` and `y` coordinates and for the segment to extend at `angle` for the given `length`.
- Updated `readOnly` doclet to `readonly`
- `array` refined to `type[]`, where such information was immediately
determinable.
- Updated {Any}/{*} to {any}; {...*} is standard exception
- Udated {Object} to {object}
There are no known breaking changes.
- Timer
- Uses standard Math.min/Math.max (it's better 2, 3 items).
- Math
- Updated documentation
- Marked various Math functions as deprecated, proxying as appropriate
- Array-based functions -> ArrayUtils
- RNG-based functions -> Utils
- Updated core-usage
- floor/ceil should not be used (alternatives provided)
- Altered for some equivalencies
- Also fixes some assorted issues
- Marked a few internal functions as private
- Utils
- Moved polyfills to their own file for better visibility
- Moved array functions to ArrayUtils and marked proxies as deprecated
- Created Phaser.ArrayUtils for array-related functions
- polyfills moved to their own file
- Functions given function names
- Added Math.trunc
- Added `compatibility` settings
- CHANGE (2.1.2-4): moved `supportsFullScreen` and `noMargins` into it
- Added additional properties for greater control and up-front settings.
- `scrollTo`: where the browser will scrollTo, if anywhere
- `forceMinimumDocumentHeight`: apply document element style?
- `allowShowAllExpand`: allow SHOW_ALL to try to expand? (It already
could, this allows configuration.)
- Removed `windowConstraints.top/left`. This may be a feature in the
future, but scrubbed for now.
- Added `USER_SCALE` scale mode. This is like NO_SCALE but it scales off
of a user-specified scale factor, as set by `setUserScale`. This is
marked as "experimental" as the exactly semantics of non-adjusting modes
(e.g. NO_SCALE and USER_SCALE) wrt. Canvas and "maximum" size clamps
need to be re-examined.
- FIX: `onSizeChange` now works as documented, which means it is also
fired if the game size changes even though the game canvas size does
not.
- CHANGE (no known breaking): `margins` is now non-Point/non-Rectangle
that uses top/left/bottom/right properties (any quasi-updated x/y). This
is to get around the issue that Rectangle is only designed for positive
width/height cases.
- Cleaned up property access / quotes for consistency
- Various documentation cleanup and consistency
- Fixed issue with not clearing an unparented `_createdFullScreenTarget`
- Added Phaser.Rectangle.sameDimensions which does a strict equality check
over the `width` and `height` properties of two objects, perhaps
Rectangles.
Polygon.area is now only calculated when the Polygon points list is modified, rather than on every call.
Phaser.Polygon can now accept the points list in a variety of formats: Arrays of Points, numbers, objects with public x/y properties or any combination of, or as a parameter list (thanks @pnstickne for the original implementation #1267)
Polygon.contains now correctly calculates the result (thanks @pnstickne @BurnedToast #1267)
* Calculates the Axis Aligned Bounding Box (or aabb) from an array of points.
*
* @method Phaser.Rectangle#aabb
* @param {Phaser.Point[]} points - The array of one or more points.
* @param {Phaser.Rectangle} [out] - Optional Rectangle to store the value in, if not supplied a new Rectangle object will be created.
* @return {Phaser.Rectangle} The new Rectangle object.
* @static
static method that will take an object of any kind and return a new point based on the x & y properties of that object.
optional x & y property names can also be supplied
Point.cross - get the cross product of two Point objects.
Point.cross - get the cross product of two Point objects.
Point.perp - make the Point perpendicular (90 degrees rotation)
Point.rperp - make the Point perpendicular (-90 degrees rotation)
Point.normalRightHand - Right-hand normalize (make unit length) a Point.
Point.angle - Returns the angle between this Point object and another object with public x and y properties.
Point.angleSq - Returns the angle squared between this Point object and another object with public x and y properties.
Point.getMagnitudeSq - Calculates the length squared of the Point object.
Point.project - Project two Points onto another Point.
Point.projectUnit - Project two Points onto a Point of unit length.
Point.multiplyAdd - Adds two 2D Points together and multiplies the result by the given scalar.
Point.negative - Creates a negative Point.
Point.cross - get the cross product of two Point objects.
Point.cross - get the cross product of two Point objects.
Point.perp - make the Point perpendicular (90 degrees rotation)
Point.rperp - make the Point perpendicular (-90 degrees rotation)
Debug.renderPhysicsBody(body, color) is extremely useful for debugging the new physics bodies. Will draw the outline + points in the color given.
Debug.renderBodyInfo(sprite, x, y, color) will display lots of Sprite body data.