mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Added Line Clone, CopyFrom and Equals and fixed some build errors.
This commit is contained in:
parent
1deac35550
commit
fa14825473
8 changed files with 64 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
var CHECKSUM = {
|
||||
build: '20cbbc80-c7e5-11e6-b229-2d3070a0413b'
|
||||
build: 'a9e8c060-d2dc-11e6-8d87-49514174f937'
|
||||
};
|
||||
module.exports = CHECKSUM;
|
|
@ -11,9 +11,9 @@ Circle.ContainsPoint = require('./ContainsPoint');
|
|||
Circle.ContainsRect = require('./ContainsRect');
|
||||
Circle.CopyFrom = require('./CopyFrom');
|
||||
Circle.Equals = require('./Equals');
|
||||
Circle.GetBounds = require('./GetBounds');
|
||||
Circle.Offset = require('./Offset');
|
||||
Circle.OffsetPoint = require('./OffsetPoint');
|
||||
Circle.Overlaps = require('./Overlaps');
|
||||
Circle.Random = require('./Random');
|
||||
|
||||
module.exports = Circle;
|
||||
|
|
|
@ -5,6 +5,7 @@ module.exports = {
|
|||
Circle: require('./circle'),
|
||||
Ellipse: require('./ellipse'),
|
||||
Intersects: require('./intersects'),
|
||||
Line: require('./line'),
|
||||
Point: require('./point'),
|
||||
Rectangle: require('./rectangle')
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var Rectangle = require('../rectangle/Rectangle');
|
||||
var RectangleVsRectangle = require('./RectangleVsRectangle');
|
||||
var RectangleToRectangle = require('./RectangleToRectangle');
|
||||
|
||||
var GetRectangleIntersection = function (rectA, rectB, output)
|
||||
{
|
||||
if (output === undefined) { output = new Rectangle(); }
|
||||
|
||||
if (RectangleVsRectangle(rectA, rectB))
|
||||
if (RectangleToRectangle(rectA, rectB))
|
||||
{
|
||||
output.x = Math.max(rectA.x, rectB.x);
|
||||
output.y = Math.max(rectA.y, rectB.y);
|
||||
|
|
8
v3/src/geom/line/Clone.js
Normal file
8
v3/src/geom/line/Clone.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
var Line = require('./Line');
|
||||
|
||||
var Clone = function (source)
|
||||
{
|
||||
return new Line(source.x1, source.y1, source.x2, source.y2);
|
||||
};
|
||||
|
||||
module.exports = Clone;
|
12
v3/src/geom/line/CopyFrom.js
Normal file
12
v3/src/geom/line/CopyFrom.js
Normal 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.x1, source.y1, source.x2, source.y2);
|
||||
};
|
||||
|
||||
module.exports = CopyFrom;
|
11
v3/src/geom/line/Equals.js
Normal file
11
v3/src/geom/line/Equals.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var Equals = function (line, toCompare)
|
||||
{
|
||||
return (
|
||||
line.x1 === toCompare.x1 &&
|
||||
line.y1 === toCompare.y1 &&
|
||||
line.x2 === toCompare.x2 &&
|
||||
line.y2 === toCompare.y2
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = Equals;
|
28
v3/src/geom/line/index.js
Normal file
28
v3/src/geom/line/index.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Phaser.Geom.Line
|
||||
|
||||
var Line = require('./Line');
|
||||
|
||||
Line.Angle = require('./Angle');
|
||||
Line.CenterOn = require('./CenterOn');
|
||||
Line.Clone = require('./Clone');
|
||||
Line.CopyFrom = require('./CopyFrom');
|
||||
Line.Equals = require('./Equals');
|
||||
Line.GetMidPoint = require('./GetMidPoint');
|
||||
Line.GetNormal = require('./GetNormal');
|
||||
Line.GetPointsOnLine = require('./GetPointsOnLine');
|
||||
Line.Height = require('./Height');
|
||||
Line.Length = require('./Length');
|
||||
Line.NormalAngle = require('./NormalAngle');
|
||||
Line.NormalX = require('./NormalX');
|
||||
Line.NormalY = require('./NormalY');
|
||||
Line.PerpSlope = require('./PerpSlope');
|
||||
Line.Random = require('./Random');
|
||||
Line.ReflectAngle = require('./ReflectAngle');
|
||||
Line.Rotate = require('./Rotate');
|
||||
Line.RotateAroundPoint = require('./RotateAroundPoint');
|
||||
Line.RotateAroundXY = require('./RotateAroundXY');
|
||||
Line.SetToAngle = require('./SetToAngle');
|
||||
Line.Slope = require('./Slope');
|
||||
Line.Width = require('./Width');
|
||||
|
||||
module.exports = Line;
|
Loading…
Reference in a new issue