mirror of
https://github.com/photonstorm/phaser
synced 2024-11-29 08:01:04 +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,
|
originX: 0.5,
|
||||||
originY: 0.5,
|
originY: 0.5,
|
||||||
|
|
||||||
displayOriginX: {
|
// READ ONLY
|
||||||
|
displayOriginX: 0,
|
||||||
get: function ()
|
displayOriginY: 0,
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
setOrigin: function (x, y)
|
setOrigin: function (x, y)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +19,7 @@ var Origin = {
|
||||||
this.originX = x;
|
this.originX = x;
|
||||||
this.originY = y;
|
this.originY = y;
|
||||||
|
|
||||||
return this;
|
return this.updateOrigin();
|
||||||
},
|
},
|
||||||
|
|
||||||
setDisplayOrigin: function (x, y)
|
setDisplayOrigin: function (x, y)
|
||||||
|
@ -54,6 +30,17 @@ var Origin = {
|
||||||
this.displayOriginX = x;
|
this.displayOriginX = x;
|
||||||
this.displayOriginY = y;
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue