@@ -185,6 +185,10 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
185185 this . setCapInsetsPressedRenderer ( this . _capInsetsPressed ) ;
186186 this . setCapInsetsDisabledRenderer ( this . _capInsetsDisabled ) ;
187187 this . setBright ( this . _bright ) ;
188+
189+ this . _normalTextureAdaptDirty = true ;
190+ this . _pressedTextureAdaptDirty = true ;
191+ this . _disabledTextureAdaptDirty = true ;
188192 } ,
189193
190194 /**
@@ -506,33 +510,31 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
506510 if ( this . pressedActionEnabled ) {
507511 this . _buttonNormalRenderer . stopAllActions ( ) ;
508512 this . _buttonClickedRenderer . stopAllActions ( ) ;
509- var zoomAction = cc . scaleTo ( ccui . Button . ZOOM_ACTION_TIME_STEP , this . _normalTextureScaleXInSize , this . _normalTextureScaleYInSize ) ;
510- this . _buttonNormalRenderer . runAction ( zoomAction ) ;
513+ //var zoomAction = cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP, this._normalTextureScaleXInSize, this._normalTextureScaleYInSize);
514+ //fixme: the zoomAction will run in the next frame which will cause the _buttonNormalRenderer to a wrong scale
515+ //this._buttonNormalRenderer.runAction(zoomAction);
516+ this . _buttonNormalRenderer . setScale ( this . _normalTextureScaleXInSize , this . _normalTextureScaleYInSize ) ;
511517 this . _buttonClickedRenderer . setScale ( this . _pressedTextureScaleXInSize , this . _pressedTextureScaleYInSize ) ;
512518
513519 this . _titleRenderer . stopAllActions ( ) ;
514520 if ( this . _unifySize ) {
515521 var zoomTitleAction = cc . scaleTo ( ccui . Button . ZOOM_ACTION_TIME_STEP , 1 , 1 ) ;
516522 this . _titleRenderer . runAction ( zoomTitleAction ) ;
517- } else
518- this . _titleRenderer . runAction ( zoomAction . clone ( ) ) ;
523+ } else {
524+ this . _titleRenderer . setScaleX ( 1 ) ;
525+ this . _titleRenderer . setScaleY ( 1 ) ;
526+ }
519527 }
520528 } else {
521529 this . _buttonNormalRenderer . stopAllActions ( ) ;
522530 this . _buttonNormalRenderer . setScale ( this . _normalTextureScaleXInSize , this . _normalTextureScaleYInSize ) ;
523531
524532 this . _titleRenderer . stopAllActions ( ) ;
525-
526533 if ( this . _scale9Enabled )
527534 this . _buttonNormalRenderer . setColor ( cc . color . WHITE ) ;
528535
529- if ( this . _unifySize ) {
530- this . _titleRenderer . setScaleX ( 1 ) ;
531- this . _titleRenderer . setScaleY ( 1 ) ;
532- } else {
533- this . _titleRenderer . setScaleX ( this . _normalTextureScaleXInSize ) ;
534- this . _titleRenderer . setScaleY ( this . _normalTextureScaleYInSize ) ;
535- }
536+ this . _titleRenderer . setScaleX ( 1 ) ;
537+ this . _titleRenderer . setScaleY ( 1 ) ;
536538 }
537539 } ,
538540
@@ -554,11 +556,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
554556 locNormalRenderer . setScale ( this . _pressedTextureScaleXInSize + this . _zoomScale , this . _pressedTextureScaleYInSize + this . _zoomScale ) ;
555557
556558 this . _titleRenderer . stopAllActions ( ) ;
557- if ( this . _unifySize ) {
558- var zoomTitleAction = cc . scaleTo ( ccui . Button . ZOOM_ACTION_TIME_STEP , 1 + this . _zoomScale , 1 + this . _zoomScale ) ;
559- this . _titleRenderer . runAction ( zoomTitleAction ) ;
560- } else
561- this . _titleRenderer . runAction ( zoomAction . clone ( ) ) ;
559+ this . _titleRenderer . runAction ( cc . scaleTo ( ccui . Button . ZOOM_ACTION_TIME_STEP , 1 + this . _zoomScale , 1 + this . _zoomScale ) ) ;
562560 }
563561 } else {
564562 locNormalRenderer . setVisible ( true ) ;
@@ -567,17 +565,9 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
567565 locNormalRenderer . stopAllActions ( ) ;
568566 locNormalRenderer . setScale ( this . _normalTextureScaleXInSize + this . _zoomScale , this . _normalTextureScaleYInSize + this . _zoomScale ) ;
569567
570- if ( this . _scale9Enabled )
571- locNormalRenderer . setState ( ccui . Scale9Sprite . state . GRAY ) ;
572-
573568 this . _titleRenderer . stopAllActions ( ) ;
574- if ( this . _unifySize ) {
575- this . _titleRenderer . setScaleX ( 1 + this . _zoomScale ) ;
576- this . _titleRenderer . setScaleY ( 1 + this . _zoomScale ) ;
577- } else {
578- this . _titleRenderer . setScaleX ( this . _normalTextureScaleXInSize + this . _zoomScale ) ;
579- this . _titleRenderer . setScaleY ( this . _normalTextureScaleYInSize + this . _zoomScale ) ;
580- }
569+ this . _titleRenderer . setScaleX ( 1 + this . _zoomScale ) ;
570+ this . _titleRenderer . setScaleY ( 1 + this . _zoomScale ) ;
581571 }
582572 } ,
583573
@@ -831,6 +821,15 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
831821 return this . _zoomScale ;
832822 } ,
833823
824+ /**
825+ * Returns the normalize of texture size
826+ * @since v3.3
827+ * @returns {cc.Size }
828+ */
829+ getNormalTextureSize : function ( ) {
830+ return this . _normalTextureSize ;
831+ } ,
832+
834833 /**
835834 * Sets title fontName to ccui.Button.
836835 * @param {String } fontName
0 commit comments