Skip to content

Commit b336e03

Browse files
committed
Restored original Origin class
1 parent 37bc0db commit b336e03

1 file changed

Lines changed: 15 additions & 28 deletions

File tree

v3/src/gameobjects/components/Origin.js

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,9 @@ var Origin = {
77
originX: 0.5,
88
originY: 0.5,
99

10-
displayOriginX: {
11-
12-
get: function ()
13-
{
14-
return Math.round((this.width * this.originX) * this.scaleX);
15-
},
16-
17-
set: function (value)
18-
{
19-
this.originX = this.width / value;
20-
}
21-
22-
},
23-
24-
displayOriginY: {
25-
26-
get: function ()
27-
{
28-
return Math.round((this.height * this.originY) * this.scaleY);
29-
},
30-
31-
set: function (value)
32-
{
33-
this.originY = this.height / value;
34-
}
35-
36-
},
10+
// READ ONLY
11+
displayOriginX: 0,
12+
displayOriginY: 0,
3713

3814
setOrigin: function (x, y)
3915
{
@@ -43,7 +19,7 @@ var Origin = {
4319
this.originX = x;
4420
this.originY = y;
4521

46-
return this;
22+
return this.updateOrigin();
4723
},
4824

4925
setDisplayOrigin: function (x, y)
@@ -54,6 +30,17 @@ var Origin = {
5430
this.displayOriginX = x;
5531
this.displayOriginY = y;
5632

33+
this.originX = this.width / x;
34+
this.originY = this.height / y;
35+
36+
return this;
37+
},
38+
39+
updateOrigin: function ()
40+
{
41+
this.displayOriginX = Math.round(this.originX * this.width);
42+
this.displayOriginY = Math.round(this.originY * this.height);
43+
5744
return this;
5845
}
5946

0 commit comments

Comments
 (0)