diff options
author | Eugene Sandulenko | 2017-08-03 09:48:01 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-08-04 21:54:20 +0200 |
commit | b3c8a8e1290eae0ca7628562c887cfa0ad354e6a (patch) | |
tree | 67a04a11ec18358211511f21694d2da677d73ae2 /graphics/macgui/mactext.cpp | |
parent | c5da0bece4bc8537335680cb49bd6e5b57e33073 (diff) | |
download | scummvm-rg350-b3c8a8e1290eae0ca7628562c887cfa0ad354e6a.tar.gz scummvm-rg350-b3c8a8e1290eae0ca7628562c887cfa0ad354e6a.tar.bz2 scummvm-rg350-b3c8a8e1290eae0ca7628562c887cfa0ad354e6a.zip |
GRAPHICS: MACGUI: Align and store MacText selection coordinates
Diffstat (limited to 'graphics/macgui/mactext.cpp')
-rw-r--r-- | graphics/macgui/mactext.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 7316e5a680..45e5249bc7 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -445,7 +445,7 @@ void MacText::removeLastLine() { _textMaxHeight -= h; } -void MacText::getRowCol(int x, int y, int *col, int *row) { +void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) { CLIP(y, 0, _textMaxHeight); // FIXME: We should use bsearch() here @@ -454,6 +454,8 @@ void MacText::getRowCol(int x, int y, int *col, int *row) { while (*row < _textLines.size() - 1 && _textLines[*row].y < y) (*row)++; + *sy = _textLines[*row].y; + *col = 0; int width = 0, pwidth = 0; @@ -476,8 +478,10 @@ void MacText::getRowCol(int x, int y, int *col, int *row) { *col = mcol; for (int i = str.size(); i >= 0; i--) { - if (_textLines[*row].chunks[chunk].getFont()->getStringWidth(str) + pwidth < x) { + int strw = _textLines[*row].chunks[chunk].getFont()->getStringWidth(str); + if (strw + pwidth < x) { *col = mcol + i; + *sx = strw + pwidth; break; } |