From 013ec0be9da16f456f9893e2c1ea3d71ed5b552c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 7 Apr 2006 13:27:26 +0000 Subject: [PATCH] change scroll-to to better handle boundary condition where the requested region fits exactly svn: r2636 --- src/mred/wxme/wx_medad.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mred/wxme/wx_medad.cxx b/src/mred/wxme/wx_medad.cxx index 301f59e69a..9951bec8b9 100644 --- a/src/mred/wxme/wx_medad.cxx +++ b/src/mred/wxme/wx_medad.cxx @@ -879,10 +879,16 @@ Bool wxMediaCanvas::ScrollTo(double localx, double localy, double fw, double fh, else if (// doesn't fit, bias is set: (bias == 1 && fh > ih) // fits, need to shift up into view: - || (fh <= ih && y + ih < localy + fh)) - sy = media->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset; - else if (// doesn't fit, no conflicting bias, maybe shift down to see more: - (fh > ih && bias != -1 && localy + fh > y + ih)) { + || (fh <= ih && y + ih < localy + fh)) { + double l = find_dy + localy + fh - ih; + // Find scroll pos for top of region to show: + sy = media->FindScrollLine(l); + // Unless l is exactly the top of a line, move down to the next whole line: + if (media->ScrollLineLocation(sy) != l) + sy++; + sy -= scrollOffset; + } else if (// doesn't fit, no conflicting bias, maybe shift down to see more: + (fh > ih && bias != -1 && localy + fh > y + ih)) { // Shift to one more than the first scroll position that shows last line long my; my = media->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset;