Skip to content

Commit 0b7fb7c

Browse files
authored
Merge pull request phaserjs#3163 from Antriel/master
Fixed few rectangle methods.
2 parents 4240f6c + be39bd4 commit 0b7fb7c

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/geom/rectangle/FitOutside.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ var FitOutside = function (target, source)
2727
else
2828
{
2929
// Taller than Wide
30-
target.setSize(source.width, source.width * ratio);
30+
target.setSize(source.width, source.width / ratio);
3131
}
3232

3333
return target.setPosition(
34-
(source.right / 2) - target.width / 2,
35-
(source.bottom / 2) - target.height / 2
34+
source.centerX - target.width / 2,
35+
source.centerY - target.height / 2
3636
);
3737
};
3838

src/geom/rectangle/GetCenter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var Point = require('../point/Point');
22

3-
// The center of the Rectangle object, expressed as a Point object
3+
// The center of the Rectangle object, expressed as a Point object
44

55
/**
66
* [description]
@@ -17,8 +17,8 @@ var GetCenter = function (rect, out)
1717
{
1818
if (out === undefined) { out = new Point(); }
1919

20-
out.x = rect.right / 2;
21-
out.y = rect.bottom / 2;
20+
out.x = rect.centerX;
21+
out.y = rect.centerY;
2222

2323
return out;
2424
};

src/geom/rectangle/Union.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var Union = function (rectA, rectB, out)
1919
var x = Math.min(rectA.x, rectB.x);
2020
var y = Math.min(rectA.y, rectB.y);
2121

22-
return out.set(
22+
return out.setTo(
2323
x,
2424
y,
2525
Math.max(rectA.right, rectB.right) - x,

0 commit comments

Comments
 (0)