mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
fix(ui): clip selection background rects to the widget's visible area (#1770)
This commit is contained in:
parent
36f4595793
commit
ef80e7f5dc
1 changed files with 7 additions and 2 deletions
|
|
@ -172,8 +172,13 @@ void UITextEdit::drawSelf(const DrawPoolType drawPane)
|
|||
}
|
||||
}
|
||||
|
||||
if (width > 0)
|
||||
m_glyphsSelectBgRectCache.emplace_back(Rect(pos.x, pos.y, width, lineHeight));
|
||||
if (width > 0) {
|
||||
// clip to the widget's visible area, like glyph coords do; otherwise
|
||||
// selection rects for scrolled-out lines are drawn outside the widget
|
||||
const Rect bgRect = Rect(pos.x, pos.y, width, lineHeight).intersection(getPaddingRect());
|
||||
if (bgRect.isValid())
|
||||
m_glyphsSelectBgRectCache.emplace_back(bgRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue