P2.PointProxy.mx and my values are get and set in meters with no pixel conversion taking place.

P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
P2.PointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
P2.InversePointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
This commit is contained in:
photonstorm 2014-08-28 16:29:07 +01:00
parent 8bc4f90630
commit 6fbaa36ddd
3 changed files with 95 additions and 11 deletions

View file

@ -90,11 +90,13 @@ Version 2.1.0 - "Cairhien" - -in development-
* Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
* SinglePad.destroy now clears all associated GamepadButton objects and signals.
* Device.node and Device.nodeWebKit are two new properties (thanks @videlais #1129)
* P2.PointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
* P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
### Updates
* TypeScript definition updates to help fix for the `noimplicitany` option (thanks @Waog #1088)
* TypeScript definitions fixes and updates (thanks @clark-stevenson and @rhmoller)
* TypeScript definitions fixes and updates (thanks @clark-stevenson @englercj and @rhmoller)
* All of the Pixi geom classes have been removed from the build file as they aren't needed (the Phaser.Geom classes overwrite them), saving some space in the process.
* Improved consistency of clone methods on geometry classes (thanks @beeglebug #1130)
* Removed Cache.isSpriteSheet method as no longer required (see #1059)
@ -108,6 +110,8 @@ Version 2.1.0 - "Cairhien" - -in development-
* P2.World.defaultFriction and defaultRestitution have been removed due to deprecation.
* Canvas.create noCocoon parameter has been removed due to deprecation.
* Color.getColorInfo, RGBtoHexstring, RGBtoWebstring and colorToHexstring has been removed due to deprecation.
* P2.PointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
* P2.InversePointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
### Bug Fixes

View file

@ -24,10 +24,50 @@ Phaser.Physics.P2.InversePointProxy.prototype.constructor = Phaser.Physics.P2.In
/**
* @name Phaser.Physics.P2.InversePointProxy#x
* @property {number} x - The x property of this InversePointProxy.
* @property {number} x - The x property of this InversePointProxy get and set in pixels.
*/
Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "x", {
get: function () {
return this.world.mpxi(this.destination[0]);
},
set: function (value) {
this.destination[0] = this.world.pxmi(value);
}
});
/**
* @name Phaser.Physics.P2.InversePointProxy#y
* @property {number} y - The y property of this InversePointProxy get and set in pixels.
*/
Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "y", {
get: function () {
return this.world.mpxi(this.destination[1]);
},
set: function (value) {
this.destination[1] = this.world.pxmi(value);
}
});
/**
* @name Phaser.Physics.P2.InversePointProxy#mx
* @property {number} mx - The x property of this InversePointProxy get and set in meters.
*/
Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "mx", {
get: function () {
return this.destination[0];
@ -36,17 +76,17 @@ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "x", {
set: function (value) {
this.destination[0] = this.world.pxm(-value);
this.destination[0] = -value;
}
});
/**
* @name Phaser.Physics.P2.InversePointProxy#y
* @property {number} y - The y property of this InversePointProxy.
* @name Phaser.Physics.P2.InversePointProxy#my
* @property {number} my - The y property of this InversePointProxy get and set in meters.
*/
Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "y", {
Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "my", {
get: function () {
@ -56,7 +96,7 @@ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "y", {
set: function (value) {
this.destination[1] = this.world.pxm(-value);
this.destination[1] = -value;
}

View file

@ -24,13 +24,13 @@ Phaser.Physics.P2.PointProxy.prototype.constructor = Phaser.Physics.P2.PointProx
/**
* @name Phaser.Physics.P2.PointProxy#x
* @property {number} x - The x property of this PointProxy.
* @property {number} x - The x property of this PointProxy get and set in pixels.
*/
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "x", {
get: function () {
return this.destination[0];
return this.world.mpx(this.destination[0]);
},
@ -44,13 +44,13 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "x", {
/**
* @name Phaser.Physics.P2.PointProxy#y
* @property {number} y - The y property of this PointProxy.
* @property {number} y - The y property of this PointProxy get and set in pixels.
*/
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "y", {
get: function () {
return this.destination[1];
return this.world.mpx(this.destination[1]);
},
@ -61,3 +61,43 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "y", {
}
});
/**
* @name Phaser.Physics.P2.PointProxy#mx
* @property {number} mx - The x property of this PointProxy get and set in meters.
*/
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "mx", {
get: function () {
return this.destination[0];
},
set: function (value) {
this.destination[0] = value;
}
});
/**
* @name Phaser.Physics.P2.PointProxy#my
* @property {number} my - The x property of this PointProxy get and set in meters.
*/
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "my", {
get: function () {
return this.destination[1];
},
set: function (value) {
this.destination[1] = value;
}
});