mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 14:10:42 +00:00
Restored original Origin class
This commit is contained in:
parent
37bc0dbdcd
commit
b336e03c77
1 changed files with 15 additions and 28 deletions
|
@ -7,33 +7,9 @@ var Origin = {
|
|||
originX: 0.5,
|
||||
originY: 0.5,
|
||||
|
||||
displayOriginX: {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return Math.round((this.width * this.originX) * this.scaleX);
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.originX = this.width / value;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
displayOriginY: {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return Math.round((this.height * this.originY) * this.scaleY);
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.originY = this.height / value;
|
||||
}
|
||||
|
||||
},
|
||||
// READ ONLY
|
||||
displayOriginX: 0,
|
||||
displayOriginY: 0,
|
||||
|
||||
setOrigin: function (x, y)
|
||||
{
|
||||
|
@ -43,7 +19,7 @@ var Origin = {
|
|||
this.originX = x;
|
||||
this.originY = y;
|
||||
|
||||
return this;
|
||||
return this.updateOrigin();
|
||||
},
|
||||
|
||||
setDisplayOrigin: function (x, y)
|
||||
|
@ -54,6 +30,17 @@ var Origin = {
|
|||
this.displayOriginX = x;
|
||||
this.displayOriginY = y;
|
||||
|
||||
this.originX = this.width / x;
|
||||
this.originY = this.height / y;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
updateOrigin: function ()
|
||||
{
|
||||
this.displayOriginX = Math.round(this.originX * this.width);
|
||||
this.displayOriginY = Math.round(this.originY * this.height);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue