fix label clamp when scaled with bmfont

This commit is contained in:
zilongshanren 2015-12-02 13:48:20 +08:00
parent 70dd2af5d5
commit ed55d41858
2 changed files with 3 additions and 3 deletions

View File

@ -840,14 +840,14 @@ bool Label::updateQuads()
_reusedRect.size.height -= clipTop;
py -= clipTop;
}
if (py - letterDef.height < _tailoredBottomY)
if (py - letterDef.height * _bmfontScale < _tailoredBottomY)
{
_reusedRect.size.height = (py < _tailoredBottomY) ? 0.f : (py - _tailoredBottomY);
}
}
if(!_enableWrap){
auto px = _lettersInfo[ctr].positionX + letterDef.width/2 + _linesOffsetX[_lettersInfo[ctr].lineIndex];
auto px = _lettersInfo[ctr].positionX + letterDef.width/2 * _bmfontScale + _linesOffsetX[_lettersInfo[ctr].lineIndex];
if(_labelWidth > 0.f){
if (px > _contentSize.width || px < 0) {
if(_overflow == Overflow::CLAMP){

View File

@ -267,7 +267,7 @@ bool Label::isHorizontalClamp()
{
auto& letterDef = _fontAtlas->_letterDefinitions[_lettersInfo[ctr].utf16Char];
auto px = _lettersInfo[ctr].positionX + letterDef.width/2;
auto px = _lettersInfo[ctr].positionX + letterDef.width/2 * _bmfontScale;
if(_labelWidth > 0.f){
if (px > _contentSize.width) {
letterClamp = true;