change scroll-to to better handle boundary condition where the requested region fits exactly

svn: r2636
This commit is contained in:
Matthew Flatt 2006-04-07 13:27:26 +00:00
parent e37c2fccfc
commit 013ec0be9d

View File

@ -879,10 +879,16 @@ Bool wxMediaCanvas::ScrollTo(double localx, double localy, double fw, double fh,
else if (// doesn't fit, bias is set: else if (// doesn't fit, bias is set:
(bias == 1 && fh > ih) (bias == 1 && fh > ih)
// fits, need to shift up into view: // fits, need to shift up into view:
|| (fh <= ih && y + ih < localy + fh)) || (fh <= ih && y + ih < localy + fh)) {
sy = media->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset; double l = find_dy + localy + fh - ih;
else if (// doesn't fit, no conflicting bias, maybe shift down to see more: // Find scroll pos for top of region to show:
(fh > ih && bias != -1 && localy + fh > y + ih)) { 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 // Shift to one more than the first scroll position that shows last line
long my; long my;
my = media->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset; my = media->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset;