changeset 1436:a844e4fd4abf

RT-23256: ScrollPane with large content using mouse wheel is useless
author David Grieve<david.grieve@oracle.com>
date Thu, 12 Jul 2012 16:20:57 -0400
parents 2e6dd4d24206
children eca72eaec20d
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu Jul 12 00:28:13 2012 -0400
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu Jul 12 16:20:57 2012 -0400
@@ -470,7 +470,13 @@
                 */
                 if (vsb.getVisibleAmount() < vsb.getMax()) {
                     double vRange = getSkinnable().getVmax()-getSkinnable().getVmin();
-                    double vPixelValue = vRange / getSkinnable().getHeight();
+                    double vPixelValue;
+                    if (nodeHeight > 0.0) {
+                        vPixelValue = vRange / nodeHeight;
+                    }
+                    else {
+                        vPixelValue = 0.0;
+                    }
                     double newValue = vsb.getValue()+(-event.getDeltaY())*vPixelValue;
                     if (!PlatformUtil.isEmbedded()) {
                         if ((event.getDeltaY() > 0.0 && vsb.getValue() > vsb.getMin()) ||
@@ -496,7 +502,14 @@
 
                 if (hsb.getVisibleAmount() < hsb.getMax()) {
                     double hRange = getSkinnable().getHmax()-getSkinnable().getHmin();
-                    double hPixelValue = hRange / getSkinnable().getWidth();
+                    double hPixelValue;
+                    if (nodeWidth > 0.0) {
+                        hPixelValue = hRange / nodeWidth;
+                    }
+                    else {
+                        hPixelValue = 0.0;
+                    }
+
                     double newValue = hsb.getValue()+(-event.getDeltaX())*hPixelValue;
                     if (!PlatformUtil.isEmbedded()) {
                         if ((event.getDeltaX() > 0.0 && hsb.getValue() > hsb.getMin()) ||