You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2009/11/12 10:57:52 UTC
svn commit: r835317 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
Author: noelgrandin
Date: Thu Nov 12 09:57:48 2009
New Revision: 835317
URL: http://svn.apache.org/viewvc?rev=835317&view=rev
Log:
make vertical sliders from from bottom to top
fix usage of UP and DOWN arrow keys
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=835317&r1=835316&r2=835317&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java Thu Nov 12 09:57:48 2009
@@ -147,12 +147,12 @@
sliderY = minY;
}
- int maxY = (sliderHeight - thumbHeight) + dragOffset.y;
+ int maxY = (sliderHeight) + dragOffset.y;
if (sliderY > maxY) {
sliderY = maxY;
}
- float ratio = (float)(sliderY - dragOffset.y) / (sliderHeight - thumbHeight);
+ float ratio = (float)(sliderHeight - sliderY + dragOffset.y) / (sliderHeight - thumbHeight);
int start = slider.getStart();
int end = slider.getEnd();
@@ -229,11 +229,11 @@
int increment = length / 10;
if (keyCode == Keyboard.KeyCode.LEFT
- || keyCode == Keyboard.KeyCode.UP) {
+ || keyCode == Keyboard.KeyCode.DOWN) {
slider.setValue(Math.max(start, value - increment));
consumed = true;
} else if (keyCode == Keyboard.KeyCode.RIGHT
- || keyCode == Keyboard.KeyCode.DOWN) {
+ || keyCode == Keyboard.KeyCode.UP) {
slider.setValue(Math.min(end, value + increment));
consumed = true;
}
@@ -332,7 +332,7 @@
thumb.setLocation((int)((width - thumbWidth) * ratio), (height - thumbHeight) / 2);
} else {
thumb.setSize(thumbHeight, thumbWidth);
- thumb.setLocation((width - thumbHeight) / 2, (int)((height - thumbWidth) * ratio));
+ thumb.setLocation((width - thumbHeight) / 2, (int)(height - ((height - thumbWidth) * ratio) - thumbWidth));
}
}