File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11var CHECKSUM = {
2- build : 'e143e9e0-fe97 -11e6-b242-774fc1dcf72c '
2+ build : '923bfa40-feec -11e6-8134-ffb6fa7d3604 '
33} ;
44module . exports = CHECKSUM ;
Original file line number Diff line number Diff line change 1+ // Origin Component
2+ // Values are given in pixels, not percent
3+
4+ var Origin = {
5+
6+ originX : 0 ,
7+ originY : 0 ,
8+
9+ setOrigin : function ( x , y )
10+ {
11+ if ( x === undefined ) { x = 0 ; }
12+ if ( y === undefined ) { y = x ; }
13+
14+ this . originX = x ;
15+ this . originY = y ;
16+
17+ return this ;
18+ } ,
19+
20+ setOriginToCenter : function ( )
21+ {
22+ this . originX = this . frame . centerX ;
23+ this . originY = this . frame . centerY ;
24+ }
25+
26+ } ;
27+
28+ module . exports = Origin ;
Original file line number Diff line number Diff line change @@ -21,7 +21,18 @@ var Texture = {
2121 else
2222 {
2323 this . renderFlags |= _FLAG ;
24+
25+ if ( this . hasOwnProperty ( 'originX' ) )
26+ {
27+ // Default origin to the center
28+ var w = Math . floor ( this . frame . realWidth / 2 ) ;
29+ var h = Math . floor ( this . frame . realHeight / 2 ) ;
30+
31+ this . setOrigin ( w , h ) ;
32+ }
2433 }
34+
35+ return this ;
2536 }
2637
2738} ;
Original file line number Diff line number Diff line change @@ -18,9 +18,6 @@ var Transform = {
1818 y : 0 ,
1919 z : 0 ,
2020
21- anchorX : 0 ,
22- anchorY : 0 ,
23-
2421 scaleX : {
2522
2623 get : function ( )
@@ -120,28 +117,6 @@ var Transform = {
120117 this . scaleX = x ;
121118 this . scaleY = y ;
122119
123- return this ;
124- } ,
125-
126- setAnchor : function ( x , y )
127- {
128- if ( x === undefined ) { x = 0 ; }
129- if ( y === undefined ) { y = x ; }
130-
131- this . anchorX = x ;
132- this . anchorY = y ;
133-
134- return this ;
135- } ,
136-
137- setOffset : function ( x , y )
138- {
139- if ( x === undefined ) { x = 0 ; }
140- if ( y === undefined ) { y = x ; }
141-
142- this . offsetX = x ;
143- this . offsetY = y ;
144-
145120 return this ;
146121 }
147122
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module.exports = {
66 Color : require ( './Color' ) ,
77 Data : require ( './Data' ) ,
88 GetBounds : require ( './GetBounds' ) ,
9+ Origin : require ( './Origin' ) ,
910 ScaleMode : require ( './ScaleMode' ) ,
1011 Size : require ( './Size' ) ,
1112 Texture : require ( './Texture' ) ,
You can’t perform that action at this time.
0 commit comments