Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UIText issue and Label getContentSize value wrong in retina mode #3306

Merged
merged 1 commit into from
Jun 27, 2016

Conversation

pandamicro
Copy link
Contributor

@pandamicro pandamicro commented Jun 24, 2016

Fixed: #3294

@pandamicro
Copy link
Contributor Author

Hi, @ntrrgc the issue with label under retina display have been fixed, please take a look

node._strokeShadowOffsetX = locStrokeShadowOffsetX;
node._strokeShadowOffsetY = locStrokeShadowOffsetY;

// need computing _anchorPointInPoints
var locAP = node._anchorPoint;
this._anchorPointInPoints.x = (locStrokeShadowOffsetX * 0.5) + ((locSize.width - locStrokeShadowOffsetX) * locAP.x);
this._anchorPointInPoints.y = (locStrokeShadowOffsetY * 0.5) + ((locSize.height - locStrokeShadowOffsetY) * locAP.y);
this._anchorPointInPoints.y = (locStrokeShadowOffsetY * 0.5) + ((locSize.width - locStrokeShadowOffsetY) * locAP.y);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have you substituted height for width here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad 😂

@ntrrgc
Copy link
Contributor

ntrrgc commented Nov 9, 2016

How is it supposed to work? setTextureRect() will overwrite the _contentSize you set in the render command object.

this._texRect.height = locSize.height;
}
var nodeW = locSize.width / pixelRatio, nodeH = locSize.height / pixelRatio;
node.setContentSize(nodeW, nodeH);
Copy link
Contributor

Choose a reason for hiding this comment

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

You are setting the design content size here...

return true;
}
this._saveStatus();
node.setTextureRect(cc.rect(0, 0, width, height));
node.setTextureRect(this._texRect);
Copy link
Contributor

Choose a reason for hiding this comment

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

But it's being overwritten here. See the default implementation of setTextureRect() in CCSprite: https://github.com/cocos2d/cocos2d-html5/blob/develop/cocos2d/core/sprites/CCSprite.js#L738

@ntrrgc
Copy link
Contributor

ntrrgc commented Nov 9, 2016

I don't know if it's better or worse, but here is a simpler solution: #3407

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.

2 participants