Text box shows text near the cursor when being edited
This commit is contained in:
parent
278792a0ff
commit
220eb34ab9
1 changed files with 6 additions and 1 deletions
|
|
@ -150,7 +150,12 @@ template <typename T> class TextBox : public Element {
|
|||
|
||||
canvas->clipRect(SkRect::MakeXYWH(bb.min.x(), bb.min.y(), bb.width(), bb.height()));
|
||||
|
||||
canvas->translate(bb.min.x(), bb.min.y());
|
||||
if(singleLine && selection.selected) {
|
||||
SkRect cursorRect = textbox.getLocation(cur.pos);
|
||||
canvas->translate(bb.min.x() - std::max(cursorRect.fRight - bb.width(), 0.0f), bb.min.y());
|
||||
}
|
||||
else
|
||||
canvas->translate(bb.min.x(), bb.min.y());
|
||||
|
||||
textbox.setFont(SkFont(io.textTypeface, io.fontSize));
|
||||
textbox.setFontMgr(io.textFontMgr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue