Check scrolling against text rect limits. Fixes bug 1240 (and maybe 1241
too) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku Inc.
|
* Copyright 2001-2007, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -4002,12 +4002,17 @@ BTextView::PerformAutoScrolling()
|
|||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
BPoint scrollBy;
|
BPoint scrollBy;
|
||||||
|
|
||||||
// TODO: refine horizontal scrolling, for example by
|
BPoint constraint = fWhere;
|
||||||
// scrolling char by char and not using fixed values
|
constraint.ConstrainTo(bounds);
|
||||||
|
// Scroll char by char horizontally
|
||||||
|
// TODO: Check how BeOS R5 behaves
|
||||||
|
float value = StyledWidthUTF8Safe(OffsetAt(constraint), 1);
|
||||||
if (fWhere.x > bounds.right) {
|
if (fWhere.x > bounds.right) {
|
||||||
scrollBy.x = floorf((fWhere.x - bounds.right) / 10);
|
if (bounds.right + value <= fTextRect.Width())
|
||||||
|
scrollBy.x = value;
|
||||||
} else if (fWhere.x < bounds.left) {
|
} else if (fWhere.x < bounds.left) {
|
||||||
scrollBy.x = floorf((fWhere.x - bounds.left) / 10); // negative value
|
if (bounds.left - value >= 0)
|
||||||
|
scrollBy.x = -value;
|
||||||
}
|
}
|
||||||
|
|
||||||
float lineHeight = 0;
|
float lineHeight = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user