aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-26 07:49:03 -0400
committerPaul Gilbert2015-07-26 07:49:03 -0400
commitd8cdaabadfa67526794d83e6ab7c59bb46f1b54c (patch)
tree3de38a224f2ba923c2c74dd0e56983e19b8cfd04 /engines/sherlock
parent05eb787ce5fcc41daf2d26eec015e895f7e7ed02 (diff)
downloadscummvm-rg350-d8cdaabadfa67526794d83e6ab7c59bb46f1b54c.tar.gz
scummvm-rg350-d8cdaabadfa67526794d83e6ab7c59bb46f1b54c.tar.bz2
scummvm-rg350-d8cdaabadfa67526794d83e6ab7c59bb46f1b54c.zip
SHERLOCK: RT: Further fixes for scrolling in Files dialog
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp17
-rw-r--r--engines/sherlock/tattoo/widget_files.cpp2
2 files changed, 3 insertions, 16 deletions
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index e0b903916b..cc8e5c94c0 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -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
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index 4a0c0495e0..29ca0c56fe 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -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);