@@ -36,6 +36,9 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
36
36
_fontSize : 0 ,
37
37
_onSelectedScaleOffset : 0 ,
38
38
_labelRenderer : "" ,
39
+ _textAreaSize :null ,
40
+ _textVerticalAlignment :0 ,
41
+ _textHorizontalAlignment :0 ,
39
42
ctor : function ( ) {
40
43
ccs . Widget . prototype . ctor . call ( this ) ;
41
44
this . _touchScaleChangeEnabled = false ;
@@ -45,6 +48,9 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
45
48
this . _fontSize = 10 ;
46
49
this . _onSelectedScaleOffset = 0.5 ;
47
50
this . _labelRenderer = "" ;
51
+ this . _textAreaSize = cc . size ( 0 , 0 ) ;
52
+ this . _textVerticalAlignment = 0 ;
53
+ this . _textHorizontalAlignment = 0 ;
48
54
} ,
49
55
50
56
init : function ( ) {
@@ -110,6 +116,8 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
110
116
* @param {cc.Size } size
111
117
*/
112
118
setTextAreaSize : function ( size ) {
119
+ this . _textAreaSize . width = size . width ;
120
+ this . _textAreaSize . height = size . height ;
113
121
this . _labelRenderer . setDimensions ( size ) ;
114
122
this . labelScaleChangedWithSize ( ) ;
115
123
} ,
@@ -119,6 +127,7 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
119
127
* @param {cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT } alignment Horizontal Alignment
120
128
*/
121
129
setTextHorizontalAlignment : function ( alignment ) {
130
+ this . _textHorizontalAlignment = alignment ;
122
131
this . _labelRenderer . setHorizontalAlignment ( alignment ) ;
123
132
this . labelScaleChangedWithSize ( ) ;
124
133
} ,
@@ -128,6 +137,7 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
128
137
* @param {cc.VERTICAL_TEXT_ALIGNMENT_TOP|cc.VERTICAL_TEXT_ALIGNMENT_CENTER|cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM } verticalAlignment
129
138
*/
130
139
setTextVerticalAlignment : function ( alignment ) {
140
+ this . _textVerticalAlignment = alignment ;
131
141
this . _labelRenderer . setVerticalAlignment ( alignment ) ;
132
142
this . labelScaleChangedWithSize ( ) ;
133
143
} ,
@@ -301,7 +311,6 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
301
311
this . _labelRenderer . setScaleX ( scaleX ) ;
302
312
this . _labelRenderer . setScaleY ( scaleY ) ;
303
313
}
304
-
305
314
} ,
306
315
307
316
/**
@@ -321,6 +330,9 @@ ccs.Label = ccs.Widget.extend(/** @lends ccs.Label# */{
321
330
this . setFontSize ( uiLabel . _labelRenderer . getFontSize ( ) ) ;
322
331
this . setText ( uiLabel . getStringValue ( ) ) ;
323
332
this . setTouchScaleChangeEnabled ( uiLabel . _touchScaleChangeEnabled ) ;
333
+ this . setTextAreaSize ( uiLabel . _size ) ;
334
+ this . setTextHorizontalAlignment ( uiLabel . _textHorizontalAlignment ) ;
335
+ this . setTextVerticalAlignment ( uiLabel . _textVerticalAlignment ) ;
324
336
}
325
337
} ) ;
326
338
/**
0 commit comments