Skip to content

Commit ac10928

Browse files
authored
Revert "web UIButton support BMFont"
1 parent 9d110ee commit ac10928

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

Diff for: extensions/ccui/uiwidgets/UIButton.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,12 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
100100
}
101101
},
102102

103-
_createTitleRendererIfNeeded: function (fntFile) {
103+
_createTitleRendererIfNeeded: function ( ) {
104104
if(!this._titleRenderer) {
105-
if(fntFile != null)
106-
{
107-
this._titleRenderer = new cc.LabelBMFont("", fntFile);
108-
this._titleRenderer.setAlignment(cc.TEXT_ALIGNMENT_CENTER);
109-
}
110-
else
111-
{
112-
this._titleRenderer = new cc.LabelTTF("");
113-
this._titleRenderer.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
114-
}
115-
116-
this._titleRenderer.setAnchorPoint(0.5, 0.4);
105+
this._titleRenderer = new cc.LabelTTF("");
106+
this._titleRenderer.setAnchorPoint(0.5, 0.5);
117107
this._titleColor = cc.color.WHITE;
118-
108+
this._titleRenderer.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
119109
this.addProtectedChild(this._titleRenderer, ccui.Button.TITLE_RENDERER_ZORDER, -1);
120110
}
121111
},
@@ -667,11 +657,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
667657
setTitleFontSize: function (size) {
668658
this._createTitleRendererIfNeeded();
669659

670-
if(this._titleRenderer.setFontSize)
671-
this._titleRenderer.setFontSize(size);
672-
else
673-
this._titleRenderer.setBoundingWidth(size);
674-
660+
this._titleRenderer.setFontSize(size);
675661
this._fontSize = size;
676662
},
677663

@@ -719,9 +705,9 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
719705
* @param {String} fontName
720706
*/
721707
setTitleFontName: function (fontName) {
722-
this._createTitleRendererIfNeeded(fontName);
708+
this._createTitleRendererIfNeeded();
723709

724-
this._titleRenderer.setFontName && this._titleRenderer.setFontName(fontName);
710+
this._titleRenderer.setFontName(fontName);
725711
this._fontName = fontName;
726712
},
727713

0 commit comments

Comments
 (0)