Skip to content

Commit 93ed950

Browse files
committed
Small geom tidy-up.
1 parent f4d55b7 commit 93ed950

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

src/geom/Circle.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@ Phaser.Circle = function (x, y, diameter) {
3636
*/
3737
this._diameter = diameter;
3838

39+
/**
40+
* @property {number} _radius - The radius of the circle.
41+
* @private
42+
*/
43+
this._radius = 0;
44+
3945
if (diameter > 0)
4046
{
41-
/**
42-
* @property {number} _radius - The radius of the circle.
43-
* @private
44-
*/
4547
this._radius = diameter * 0.5;
4648
}
47-
else
48-
{
49-
this._radius = 0;
50-
}
5149

5250
/**
5351
* @property {number} type - The const type of this object.
@@ -59,24 +57,28 @@ Phaser.Circle = function (x, y, diameter) {
5957

6058
Phaser.Circle.prototype = {
6159

62-
type: null,
63-
6460
/**
6561
* The circumference of the circle.
62+
*
6663
* @method Phaser.Circle#circumference
67-
* @return {number}
64+
* @return {number} The circumference of the circle.
6865
*/
6966
circumference: function () {
67+
7068
return 2 * (Math.PI * this._radius);
69+
7170
},
7271

7372
/**
74-
* Returns the framing rectangle of the circle as a Phaser.Rectangle object
73+
* Returns the framing rectangle of the circle as a Phaser.Rectangle object.
74+
*
7575
* @method Phaser.Circle#getBounds
7676
* @return {Phaser.Rectangle} The bounds of the Circle.
7777
*/
7878
getBounds: function () {
79-
return new Phaser.Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);
79+
80+
return new Phaser.Rectangle(this.x - this.radius, this.y - this.radius, this.diameter, this.diameter);
81+
8082
},
8183

8284
/**
@@ -230,6 +232,7 @@ Phaser.Circle.prototype.constructor = Phaser.Circle;
230232

231233
/**
232234
* The largest distance between any two points on the circle. The same as the radius * 2.
235+
*
233236
* @name Phaser.Circle#diameter
234237
* @property {number} diameter - Gets or sets the diameter of the circle.
235238
*/

src/geom/Ellipse.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818
Phaser.Ellipse = function (x, y, width, height) {
1919

20-
this.type = Phaser.ELLIPSE;
21-
2220
x = x || 0;
2321
y = y || 0;
2422
width = width || 0;

0 commit comments

Comments
 (0)