Merge remote-tracking branch 'photonstorm/master'

This commit is contained in:
samme 2017-01-03 11:52:47 -08:00
commit 1dc1dacb35
16 changed files with 212 additions and 1 deletions

View file

@ -8,6 +8,7 @@
### Updates
* Clarification of `group.exists` behavior
* Clarification of fixedToCamera semantics
* change Emitter.gravity from number to Phaser.Point
* Fixed issue causing tsc to crap out under certain circumstances

View file

@ -31,6 +31,7 @@ Phaser.AnimationParser = {
if (frameMax === undefined) { frameMax = -1; }
if (margin === undefined) { margin = 0; }
if (spacing === undefined) { spacing = 0; }
if (skipFrames === undefined) { skipFrames = 0; }
var img = key;

View file

@ -93,7 +93,7 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
this.alive = true;
/**
* If exists is true the group is updated, otherwise it is skipped.
* If exists is false the group will be excluded from collision checks and filters such as {@link forEachExists}. The group will not call `preUpdate` and `postUpdate` on its children and the children will not receive physics updates or camera/world boundary checks. The group will still be {@link #visible} and will still call `update` on its children.
* @property {boolean} exists
* @default
*/

9
v3/src/geom/point/Add.js Normal file
View file

@ -0,0 +1,9 @@
var Add = function (point, x, y)
{
point.x += x;
point.y += y;
return point;
};
module.exports = Add;

View file

@ -0,0 +1,8 @@
var Point = require('./Point');
var Clone = function (source)
{
return new Point(source.x, source.y);
};
module.exports = Clone;

View file

@ -0,0 +1,12 @@
/**
* Copies the x, y and diameter properties from any given object to this Circle.
* @method Phaser.Circle#copyFrom
* @param {any} source - The object to copy from.
* @return {Circle} This Circle object.
*/
var CopyFrom = function (source, dest)
{
return dest.setTo(source.x, source.y);
};
module.exports = CopyFrom;

View file

@ -0,0 +1,9 @@
var Divide = function (point, x, y)
{
point.x /= x;
point.y /= y;
return point;
};
module.exports = Divide;

View file

@ -0,0 +1,6 @@
var Equals = function (point, toCompare)
{
return (point.x === toCompare.x && point.y === toCompare.y);
};
module.exports = Equals;

View file

@ -0,0 +1,6 @@
var GetMagnitude = function (point)
{
return Math.sqrt((point.x * point.x) + (point.y * point.y));
};
module.exports = GetMagnitude;

View file

@ -0,0 +1,6 @@
var GetMagnitudeSq = function (point)
{
return (point.x * point.x) + (point.y * point.y);
};
module.exports = GetMagnitudeSq;

View file

@ -0,0 +1,12 @@
/**
* Copies the x, y and diameter properties from any given object to this Circle.
* @method Phaser.Circle#copyFrom
* @param {any} source - The object to copy from.
* @return {Circle} This Circle object.
*/
var Invert = function (point)
{
return point.setTo(point.y, point.x);
};
module.exports = Invert;

View file

@ -0,0 +1,9 @@
var Multiply = function (point, x, y)
{
point.x *= x;
point.y *= y;
return point;
};
module.exports = Multiply;

View file

@ -0,0 +1,16 @@
var GetMagnitude = require('./GetMagnitude');
var Normalize = function (point)
{
if (point.x !== 0 && point.y !== 0)
{
var m = GetMagnitude(point);
point.x /= m;
point.y /= m;
}
return point;
};
module.exports = Normalize;

View file

@ -0,0 +1,96 @@
var Point = function (x, y)
{
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
this.x = x;
this.y = y;
};
Point.prototype.constructor = Point;
Point.prototype = {
setTo: function (x, y)
{
if (x === undefined) { x = 0; }
if (y === undefined) { y = x; }
this.x = x;
this.y = y;
return this;
}
};
Object.defineProperties(Point.prototype, {
left: {
enumerable: true,
get: function ()
{
return this.x;
},
set: function (value)
{
this.x = value;
}
},
right: {
enumerable: true,
get: function ()
{
return this.x;
},
set: function (value)
{
this.x = value;
}
},
top: {
enumerable: true,
get: function ()
{
return this.y;
},
set: function (value)
{
this.y = value;
}
},
bottom: {
enumerable: true,
get: function ()
{
return this.y;
},
set: function (value)
{
this.y = value;
}
}
});
module.exports = Point;

View file

@ -0,0 +1,11 @@
var Normalize = require('./Normalize');
var Multiply = require('./Multiply');
var SetMagnitude = function (point, magnitude)
{
Normalize(point);
return Multiply(point, magnitude, magnitude);
};
module.exports = SetMagnitude;

View file

@ -0,0 +1,9 @@
var Subtract = function (point, x, y)
{
point.x -= x;
point.y -= y;
return point;
};
module.exports = Subtract;