mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
GUI: Fix bad EditTextWidget rect at low window widths
Fix bug https://bugs.scummvm.org/ticket/13339 Solution is taken from our ListWidget (gui/widgets/list.cpp) which performs a similar check in its ListWidget::getEditRect()
This commit is contained in:
parent
786800e831
commit
8fcfb7e585
@ -112,7 +112,14 @@ void EditTextWidget::drawWidget() {
|
||||
}
|
||||
|
||||
Common::Rect EditTextWidget::getEditRect() const {
|
||||
Common::Rect r(2 + _leftPadding, 1, _w - 1 - _rightPadding, _h);
|
||||
// Calculate (right - left) difference for editRect's X-axis coordinates:
|
||||
// (_w - 1 - _rightPadding) - (2 + _leftPadding)
|
||||
int editWidth = _w - _rightPadding - _leftPadding - 3;
|
||||
// Ensure r will always be a valid rect
|
||||
if (editWidth < 0) {
|
||||
editWidth = 0;
|
||||
}
|
||||
Common::Rect r(2 + _leftPadding, 1, 2 + _leftPadding + editWidth, _h);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user