changeset 1000:8a0747a8ce6d

RT-20780 : Scaling UI Controls down to QVGA: ScrollPane
author mickf
date Mon, 14 May 2012 13:59:03 +0100
parents a06b43c0bb36
children fd3b4690dd58 fa6dd67f61a5
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java
diffstat 1 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Mon May 14 12:51:57 2012 +0100
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Mon May 14 13:59:03 2012 +0100
@@ -464,19 +464,17 @@
                 ** we only consume an event that we've used.
                 */
                 if (vsb.getVisibleAmount() < vsb.getMax()) {
+                    double vRange = getSkinnable().getVmax()-getSkinnable().getVmin();
+                    double vPixelValue = vRange / getSkinnable().getHeight();
+                    double newValue = vsb.getValue()+(-event.getDeltaY())*vPixelValue;
                     if (!PlatformUtil.isEmbedded()) {
                         if ((event.getDeltaY() > 0.0 && vsb.getValue() > vsb.getMin()) ||
                             (event.getDeltaY() < 0.0 && vsb.getValue() < vsb.getMax())) {
-                            double vRange = getSkinnable().getVmax()-getSkinnable().getVmin();
-                            double vPixelValue = vRange / getSkinnable().getHeight();
-                            vsb.setValue(vsb.getValue()+(-event.getDeltaY())*vPixelValue);
+                            vsb.setValue(newValue);
                             event.consume();
                         }
                     }
                     else {
-                        double vRange = getSkinnable().getVmax()-getSkinnable().getVmin();
-                        double vPixelValue = vRange / getSkinnable().getHeight();
-                        double newValue = vsb.getValue()+(event.getDeltaY())*vPixelValue;
                         vsb.setValue(newValue);
                         if ((newValue > vsb.getMax() || newValue < vsb.getMin()) && !(mouseDown || touchDetected)) {
                             startContentsToViewport();
@@ -487,19 +485,17 @@
                 }
 
                 if (hsb.getVisibleAmount() < hsb.getMax()) {
+                    double hRange = getSkinnable().getHmax()-getSkinnable().getHmin();
+                    double hPixelValue = hRange / getSkinnable().getWidth();
+                    double newValue = hsb.getValue()+(-event.getDeltaX())*hPixelValue;
                     if (!PlatformUtil.isEmbedded()) {
                         if ((event.getDeltaX() > 0.0 && hsb.getValue() > hsb.getMin()) ||
                             (event.getDeltaX() < 0.0 && hsb.getValue() < hsb.getMax())) {
-                            double hRange = getSkinnable().getHmax()-getSkinnable().getHmin();
-                            double hPixelValue = hRange / getSkinnable().getWidth();
-                            hsb.setValue(hsb.getValue()+(-event.getDeltaX())*hPixelValue);
+                            hsb.setValue(newValue);
                             event.consume();
                         }
                     }
                     else {
-                        double hRange = getSkinnable().getHmax()-getSkinnable().getHmin();
-                        double hPixelValue = hRange / getSkinnable().getWidth();
-                        double newValue = hsb.getValue()+(event.getDeltaX())*hPixelValue;
 
                         hsb.setValue(newValue);