PINK: fix the bug when we disable the border, the text may not render correctly.

This commit is contained in:
ysj1173886760 2021-04-18 21:53:45 +08:00 committed by Eugene Sandulenko
parent 27986beebc
commit 55f61f2c69

View File

@ -112,9 +112,9 @@ void ActionText::start() {
Graphics::MacFont *font = new Graphics::MacFont;
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
_txtWnd->enableScrollbar(true);
loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar | Graphics::kWindowBorderActive);
loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar);
_txtWnd->enableScrollbar(true);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->setEditable(false);
@ -123,10 +123,15 @@ void ActionText::start() {
_txtWnd->appendText(_text, font);
// if the textHeight is smaller than the area we display the text, then we disable the scrollbar
if (_txtWnd->getTextHeight() < _txtWnd->getInnerDimensions().height()) {
delete _txtWnd;
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
_txtWnd->disableBorder();
_txtWnd->enableScrollbar(false);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->draw(true);
_txtWnd->setEditable(false);
_txtWnd->setSelectable(false);
_txtWnd->appendText(_text, font);
}
director->addTextWindow(_txtWnd);