mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #771 from zilongshanren/fixLabelResizeHeight
Fix label resize height
This commit is contained in:
@@ -382,6 +382,9 @@ var Label = cc.Class({
|
||||
sgNode.setString(this.string);
|
||||
if (CC_EDITOR && this._useOriginalSize) {
|
||||
this.node.setContentSize(sgNode.getContentSize());
|
||||
if (this.font instanceof cc.BitmapFont) {
|
||||
this.lineHeight = sgNode.getBMFontLineHeight();
|
||||
}
|
||||
this._useOriginalSize = false;
|
||||
} else {
|
||||
sgNode.setContentSize(this.node.getContentSize());
|
||||
@@ -393,7 +396,7 @@ var Label = cc.Class({
|
||||
_updateNodeSize: function () {
|
||||
var initialized = this._sgNode && this._sgNode.parent;
|
||||
if (initialized) {
|
||||
if (this.overflow === Overflow.NONE) {
|
||||
if (this.overflow === Overflow.NONE || this.overflow === Overflow.RESIZE_HEIGHT) {
|
||||
this.node.setContentSize(this._sgNode.getContentSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +343,12 @@ _ccsg.Label = _ccsg.Node.extend({
|
||||
return this._lineHeight;
|
||||
},
|
||||
|
||||
getBMFontLineHeight : function() {
|
||||
if(this._fontAtlas) {
|
||||
return this._fontAtlas._lineHeight;
|
||||
}
|
||||
},
|
||||
|
||||
setFontFileOrFamily: function(fontHandle, textureUrl) {
|
||||
fontHandle = fontHandle || "Arial";
|
||||
var extName = cc.path.extname(fontHandle);
|
||||
|
||||
Reference in New Issue
Block a user