SHERLOCK: RT: Further fixes for scrolling in Files dialog

This commit is contained in:
Paul Gilbert 2015-07-26 07:49:03 -04:00
parent 05eb787ce5
commit d8cdaabadf
2 changed files with 3 additions and 16 deletions

View File

@ -330,21 +330,8 @@ void WidgetBase::handleScrolling(int &scrollIndex, int pageSize, int max) {
yp = CLIP(yp, r.top + BUTTON_SIZE + 3, r.bottom - BUTTON_SIZE - 3);
// Calculate the line number that corresponds to the position that the mouse is on the scrollbar
int lineNum = (yp - _bounds.top - BUTTON_SIZE - 3) * 100 / (_bounds.height() - BUTTON_SIZE * 2 - 6)
* max / 100 - 3;
// If the new position would place part of the text outsidethe text window, adjust it so it doesn't
if (lineNum < 0)
lineNum = 0;
else if (lineNum + pageSize > max) {
lineNum = max - pageSize;
// Make sure it's not below zero now
if (lineNum < 0)
lineNum = 0;
}
scrollIndex = lineNum;
int lineNum = (yp - r.top - BUTTON_SIZE - 3) * (max - pageSize) / (r.height() - BUTTON_SIZE * 2 - 6);
scrollIndex = CLIP(lineNum, 0, max - pageSize);
}
// Get the current frame so we can check the scroll timer against it

View File

@ -150,7 +150,7 @@ void WidgetFiles::render(FilesRenderMode mode) {
color = INFO_TOP;
if (mode == RENDER_NAMES_AND_SCROLLBAR)
_surface.fillRect(Common::Rect(4, yp, _surface.w() - BUTTON_SIZE - 9, yp + _surface.fontHeight() - 1), TRANSPARENCY);
_surface.fillRect(Common::Rect(4, yp, _surface.w() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY);
Common::String numStr = Common::String::format("%d.", idx + 1);
_surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color);