aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2012-07-25 15:12:31 +1000
committernyamatongwe <nyamatongwe@gmail.com>2012-07-25 15:12:31 +1000
commit256a6d311049a907a134958ea4a8435c6fd9842f (patch)
treec4c061fbd174f43105fb6956db6066103ec59090
parentb74d888e9d72a7a61295dccfee1f07465f5be867 (diff)
downloadscintilla-mirror-256a6d311049a907a134958ea4a8435c6fd9842f.tar.gz
Limit horizontal touch scrolling to existing established width.
-rw-r--r--cocoa/ScintillaCocoa.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index afb0d35cb..7fc07c7c1 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1538,7 +1538,10 @@ void ScintillaCocoa::SetHorizontalScrollPos()
// Convert absolute coordinate into the range [0..1]. Keep in mind that the visible area
// does *not* belong to the scroll range.
- float relativePosition = (float) xOffset / (scrollWidth - textRect.Width());
+ int maxXOffset = scrollWidth - textRect.Width();
+ if (xOffset > maxXOffset)
+ xOffset = maxXOffset;
+ float relativePosition = (float) xOffset / maxXOffset;
[topContainer setHorizontalScrollPosition: relativePosition];
MoveFindIndicatorWithBounce(NO);
}