|
From: CVS C. to T. <the...@li...> - 2012-02-26 17:54:13
|
Revision: 679
http://themis.svn.sourceforge.net/themis/?rev=679&view=rev
Author: mark_hellegers
Date: 2012-02-26 17:54:06 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Stopped the "bouncing" when using the scrollwheel at the edge of the view.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-26 16:55:43 UTC (rev 678)
+++ trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-26 17:54:06 UTC (rev 679)
@@ -173,8 +173,27 @@
break;
}
case B_MOUSE_WHEEL_CHANGED: {
- float value = aMessage->FindFloat( "be:wheel_delta_y");
- mView->ScrollBy(0, value * 50);
+ float wheelValue = aMessage->FindFloat( "be:wheel_delta_y");
+ // We multiply it by 50 to make the scrolling usable.
+ float scrollValue = wheelValue * 50;
+ // Before we scroll, we check if we are still within the limits.
+ BScrollBar * bar = mScrollView->ScrollBar(B_VERTICAL);
+ float min = 0;
+ float max = 0;
+ bar->GetRange(&min, &max);
+ float value = bar->Value();
+ if (scrollValue + value > max) {
+ // Adjust it, so it fits.
+ scrollValue = max - value;
+ }
+ else if (scrollValue + value < min) {
+ // Adjust it, so it fits.
+ scrollValue = min - value;
+ }
+ if (scrollValue != 0) {
+ // Only scroll when it has any effect.
+ mView->ScrollBy(0, scrollValue);
+ }
break;
}
default: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|