1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-23 01:44:22 +00:00

Offset TextEditor::getTextBounds() by viewport position

This commit is contained in:
ed 2021-05-20 17:56:49 +01:00
parent f3aa49e0d3
commit 361b29edb6
2 changed files with 6 additions and 1 deletions

View file

@ -1498,7 +1498,9 @@ RectangleList<int> TextEditor::getTextBounds (Range<int> textRange)
}
}
boundingBox.offsetAll (getLeftIndent(), roundToInt ((float) getTopIndent() + yOffset));
boundingBox.offsetAll (getLeftIndent() - viewport->getViewPositionX(),
roundToInt ((float) getTopIndent() + yOffset) - viewport->getViewPositionY());
return boundingBox;
}

View file

@ -537,6 +537,9 @@ public:
/** Returns the bounding box for a range of text in the editor. As the range may span
multiple lines, this method returns a RectangleList.
The bounds are relative to the component's top-left and may extend beyond the bounds
of the component if the text is long and word wrapping is disabled.
*/
RectangleList<int> getTextBounds (Range<int> textRange);