mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14543 from zilongshanren/fixLabelOverflowShrink
fix label clamp when scaled with bmfont
This commit is contained in:
commit
706e005c3d
|
@ -840,14 +840,14 @@ bool Label::updateQuads()
|
||||||
_reusedRect.size.height -= clipTop;
|
_reusedRect.size.height -= clipTop;
|
||||||
py -= clipTop;
|
py -= clipTop;
|
||||||
}
|
}
|
||||||
if (py - letterDef.height < _tailoredBottomY)
|
if (py - letterDef.height * _bmfontScale < _tailoredBottomY)
|
||||||
{
|
{
|
||||||
_reusedRect.size.height = (py < _tailoredBottomY) ? 0.f : (py - _tailoredBottomY);
|
_reusedRect.size.height = (py < _tailoredBottomY) ? 0.f : (py - _tailoredBottomY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_enableWrap){
|
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(_labelWidth > 0.f){
|
||||||
if (px > _contentSize.width || px < 0) {
|
if (px > _contentSize.width || px < 0) {
|
||||||
if(_overflow == Overflow::CLAMP){
|
if(_overflow == Overflow::CLAMP){
|
||||||
|
|
|
@ -267,7 +267,7 @@ bool Label::isHorizontalClamp()
|
||||||
{
|
{
|
||||||
auto& letterDef = _fontAtlas->_letterDefinitions[_lettersInfo[ctr].utf16Char];
|
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(_labelWidth > 0.f){
|
||||||
if (px > _contentSize.width) {
|
if (px > _contentSize.width) {
|
||||||
letterClamp = true;
|
letterClamp = true;
|
||||||
|
|
Loading…
Reference in New Issue