Skip to content

Commit fc63d0a

Browse files
committed
Ellipse.right and Ellipse.bottom setters fixed (thanks @nextht phaserjs#1397)
Fixed double Ellipse.getBounds definition (thanks @nextht phaserjs#1397)
1 parent 3bc07d6 commit fc63d0a

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ Version 2.2.2 - "Alkindar" - in development
9696

9797
### Bug Fixes
9898

99-
* Fix / double-copy for Safari tilemap bug when rendering with delta scrolling. This fixes tilemaps not appearing to update on Safari OS X and iOS specifically (thanks @pnstickne #1498)
100-
* Simplified call to `updateTransform`. This is the unified and verified fix for #1424 #1490 #1502 and solves issues with physics tunneling under the new time step code.
99+
* Fix / double-copy for Safari tilemap bug when rendering with delta scrolling. This fixes tilemaps not appearing to update on Safari OS X and iOS specifically (thanks @pnstickne @neurofuzzy @lastnightsparty #1439 #1498)
100+
* Simplified call to `updateTransform`. This is the unified and verified fix for #1424 #1479 #1490 #1502 and solves issues with physics tunneling and visual glitches under the new time step code.
101101
* Tween.delay, Tween.repeat and Tween.yoyo will no longer throw an error if called before a TweenData object has been created (via Tween.to or Tween.from) (thanks @SomMeri #1419)
102102
* The click trampoline added for IE prevented Chrome for Android from being
103103
able to launch Full Screen mode with the default parameters for
@@ -114,6 +114,9 @@ primary input is ubiquitously a mouse. There are no known breaking compatibility
114114
* Fix floating point inaccuracy in Tween easing edge cases (thanks @jounii #1492)
115115
* Phaser.Signal was causing a CSP script-src violations in Cordova and Google Chrome Apps (thanks @elennaro #1494)
116116
* Added Events.onEnterBounds to the destroy method (thanks @legendary-mich #1497)
117+
* AnimationManager.destroy is now more careful about clearing up deep references (thanks @Arturszott #1449)
118+
* Ellipse.right and Ellipse.bottom setters fixed (thanks @nextht #1397)
119+
* Fixed double Ellipse.getBounds definition (thanks @nextht #1397)
117120

118121
### Pixi.js 2.2.0 Updates
119122

src/geom/Ellipse.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ Phaser.Ellipse.prototype = {
7070

7171
/**
7272
* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
73+
*
7374
* @method Phaser.Ellipse#getBounds
74-
* @return {Phaser.Rectangle} The bounds of the Circle.
75+
* @return {Phaser.Rectangle} The bounds of the Ellipse.
7576
*/
7677
getBounds: function () {
7778

@@ -81,6 +82,7 @@ Phaser.Ellipse.prototype = {
8182

8283
/**
8384
* Copies the x, y, width and height properties from any given object to this Ellipse.
85+
*
8486
* @method Phaser.Ellipse#copyFrom
8587
* @param {any} source - The object to copy from.
8688
* @return {Phaser.Ellipse} This Ellipse object.
@@ -193,7 +195,7 @@ Object.defineProperty(Phaser.Ellipse.prototype, "right", {
193195
}
194196
else
195197
{
196-
this.width = this.x + value;
198+
this.width = value - this.x;
197199
}
198200
}
199201

@@ -235,7 +237,7 @@ Object.defineProperty(Phaser.Ellipse.prototype, "bottom", {
235237
}
236238
else
237239
{
238-
this.height = this.y + value;
240+
this.height = value - this.y;
239241
}
240242
}
241243

@@ -266,6 +268,7 @@ Object.defineProperty(Phaser.Ellipse.prototype, "empty", {
266268

267269
/**
268270
* Return true if the given x/y coordinates are within the Ellipse object.
271+
*
269272
* @method Phaser.Ellipse.contains
270273
* @param {Phaser.Ellipse} a - The Ellipse to be checked.
271274
* @param {number} x - The X value of the coordinate to test.
@@ -279,26 +282,14 @@ Phaser.Ellipse.contains = function (a, x, y) {
279282
return false;
280283
}
281284

282-
// Normalize the coords to an ellipse with center 0,0 and a radius of 0.5
283-
var normx = ((x - a.x) / a.width) - 0.5;
284-
var normy = ((y - a.y) / a.height) - 0.5;
285+
// Normalize the coords to an ellipse with center 0,0
286+
var normx = ((x - a.x) / a.width);
287+
var normy = ((y - a.y) / a.height);
285288

286289
normx *= normx;
287290
normy *= normy;
288291

289-
return (normx + normy < 0.25);
290-
291-
};
292-
293-
/**
294-
* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
295-
*
296-
* @method Phaser.Ellipse.getBounds
297-
* @return {Phaser.Rectangle} The framing rectangle
298-
*/
299-
Phaser.Ellipse.prototype.getBounds = function() {
300-
301-
return new Phaser.Rectangle(this.x, this.y, this.width, this.height);
292+
return (normx + normy <= 1);
302293

303294
};
304295

0 commit comments

Comments
 (0)