GRAPHICS: Recalculate text area sizing if interLinear is changed.

This commit is contained in:
stevenhoefel 2017-02-07 16:26:59 +11:00
parent 2d8e52771a
commit 7d044c570c
2 changed files with 7 additions and 2 deletions

View file

@ -298,6 +298,11 @@ int MacText::getLineHeight(int line) {
return _textLines[line].height; return _textLines[line].height;
} }
void MacText::setInterLinear(int interLinear) {
_interLinear = interLinear;
recalcDims();
}
void MacText::recalcDims() { void MacText::recalcDims() {
int y = 0; int y = 0;
_textMaxWidth = 0; _textMaxWidth = 0;
@ -309,7 +314,7 @@ void MacText::recalcDims() {
_textMaxWidth = MAX(_textMaxWidth, getLineWidth(i, true)); _textMaxWidth = MAX(_textMaxWidth, getLineWidth(i, true));
} }
_textMaxHeight = y; _textMaxHeight = y - _interLinear;
} }
void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) { void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {

View file

@ -91,7 +91,7 @@ public:
MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *font, int fgcolor, int bgcolor, MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *font, int fgcolor, int bgcolor,
int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft); int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft);
void setInterLinear(int interLinear) { _interLinear = interLinear; } void setInterLinear(int interLinear);
void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff); void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
void appendText(Common::String str); void appendText(Common::String str);