You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/09/26 16:59:30 UTC
svn commit: r1526537 -
/pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
Author: smartini
Date: Thu Sep 26 14:59:30 2013
New Revision: 1526537
URL: http://svn.apache.org/r1526537
Log:
PIVOT-923, applied the patch (but applied by hand, probably it was not in the svn format)
Modified:
pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
Modified: pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java?rev=1526537&r1=1526536&r2=1526537&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java (original)
+++ pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java Thu Sep 26 14:59:30 2013
@@ -534,9 +534,10 @@ public class TerraScrollBarSkin extends
int realValue = (int)(pixelValue / getValueScale());
// Bound the value
+ int start = scrollBar.getStart();
int end = scrollBar.getEnd();
int extent = scrollBar.getExtent();
- realValue = Math.min(Math.max(realValue, 0), end - extent);
+ realValue = Math.min(Math.max(realValue - start, start), end - extent);
// Update the scroll bar
scrollBar.setValue(realValue);
@@ -718,7 +719,7 @@ public class TerraScrollBarSkin extends
// scale that maps logical value to pixel value
int numLegalPixelValues = availableWidth - handleWidth + 1;
float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleX = (int)(value * valueScale) +
+ int handleX = (int)((value - start) * valueScale) +
scrollUpButton.getWidth() - 1;
if (handleWidth > availableWidth) {
@@ -754,7 +755,7 @@ public class TerraScrollBarSkin extends
// scale maps logical value to pixel value
int numLegalPixelValues = availableHeight - handleHeight + 1;
float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleY = (int)(value * valueScale) +
+ int handleY = (int)((value - start) * valueScale) +
scrollUpButton.getHeight() - 1;
if (handleHeight > availableHeight) {
@@ -1222,15 +1223,16 @@ public class TerraScrollBarSkin extends
// would be overkill. If all that has changed is the value, we can just
// update the handle's location and save the work of full invalidation.
if (handle.isVisible()) {
+ int start = scrollBar.getStart();
int value = scrollBar.getValue();
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- int handleX = (int)(value * getValueScale()) +
+ int handleX = (int)((value - start) * getValueScale()) +
scrollUpButton.getWidth() - 1;
handle.setLocation(handleX, 0);
} else {
- int handleY = (int)(value * getValueScale()) +
+ int handleY = (int)((value - start) * getValueScale()) +
scrollUpButton.getHeight() - 1;
handle.setLocation(0, handleY);