Skip to content

fix label not updating content size#684

Merged
nantas merged 2 commits intococos:masterfrom
zilongshanren:fix-label-webgl-size-issue
May 18, 2016
Merged

fix label not updating content size#684
nantas merged 2 commits intococos:masterfrom
zilongshanren:fix-label-webgl-size-issue

Conversation

@zilongshanren
Copy link
Copy Markdown
Contributor

Re: cocos-creator/fireball#3023

Changes proposed in this pull request:

  • Fix label getContentSize doesn't updated label size after setting label string when called in button callback

@cocos-creator/engine-admins

if (!CC_EDITOR && !cc.sizeEqualToSize(this._contentSize, this._renderCmd._realRenderingSize)) {
var locFlag = this._renderCmd._dirtyFlag;
if ((locFlag & _ccsg.Node._dirtyFlags.textDirty) ||
!CC_EDITOR && !cc.sizeEqualToSize(this._contentSize, this._renderCmd._realRenderingSize)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web 下面,!CC_EDITOR 本来就是 true,你这个 if 成立的条件其实没变啊?为什么这样就行呢?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

texDrity 了呀。。。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不管是否 dirty,(locFlag & _ccsg.Node._dirtyFlags.textDirty) || !CC_EDITOR 一直都是 true 啊

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实我感觉后面的条件可以去掉了。。 那个 realRenderingSize 的优化有 bug,我去掉算了 反正只要 dirty 了 就重新算。这个才是正确的逻辑。

@zilongshanren zilongshanren force-pushed the fix-label-webgl-size-issue branch from b885c67 to 1f4770d Compare May 17, 2016 10:28
@nantas nantas merged commit c51e89f into cocos:master May 18, 2016
@zilongshanren zilongshanren deleted the fix-label-webgl-size-issue branch May 18, 2016 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants