mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #1183 from zilongshanren/fix-issue-4273
only reset node height in resize_height
This commit is contained in:
@@ -493,9 +493,17 @@ var Label = cc.Class({
|
||||
_updateNodeSize: function () {
|
||||
var initialized = this._sgNode && this._sgNode.parent;
|
||||
if (initialized) {
|
||||
if (this.overflow === Overflow.NONE || this.overflow === Overflow.RESIZE_HEIGHT) {
|
||||
if (this.overflow === Overflow.NONE) {
|
||||
this.node.setContentSize(this._sgNode.getContentSize());
|
||||
}
|
||||
|
||||
if(this.overflow === Overflow.RESIZE_HEIGHT) {
|
||||
//call this.node.getContentSize actually sync the node size with sgNode
|
||||
//such that it won't trigger setDimensions method in jsb
|
||||
var originalSize = this.node.getContentSize();
|
||||
var newSize = this._sgNode.getContentSize();
|
||||
this.node.setContentSize(cc.size(originalSize.width, newSize.height));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user