changeset 5619:853673edfc9f

RT-33949 Scroll bar thumb doesn't work on touch interface Reviewed-by: jgiles
author Martin Sladecek <martin.sladecek@oracle.com>
date Mon, 04 Nov 2013 08:16:34 +0100
parents fbb8a4ffac02
children 4a8fba6d5627
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java
diffstat 1 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Sun Nov 03 15:41:43 2013 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Mon Nov 04 08:16:34 2013 +0100
@@ -1469,34 +1469,34 @@
                 breadthBar.setVisibleAmount((viewportBreadth / getMaxPrefBreadth()) * newMax);
             }
         }
+        
+        // determine how many cells there are on screen so that the scrollbar
+        // thumb can be appropriately sized
+        if (recreate && (lengthBar.isVisible() || BehaviorSkinBase.IS_TOUCH_SUPPORTED)) {
+            int numCellsVisibleOnScreen = 0;
+            for (int i = 0, max = cells.size(); i < max; i++) {
+                T cell = cells.get(i);
+                if (cell != null && !cell.isEmpty()) {
+                    sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth());
+                    if (sumCellLength > flowLength) {
+                        break;
+                    }
 
-        if (lengthBar.isVisible()) {
-            // determine how many cells there are on screen so that the scrollbar
-            // thumb can be appropriately sized
-            if (recreate) {
-                int numCellsVisibleOnScreen = 0;
-                for (int i = 0, max = cells.size(); i < max; i++) {
-                    T cell = cells.get(i);
-                    if (cell != null && ! cell.isEmpty()) {
-                        sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth());
-                        if (sumCellLength > flowLength) {
-                            break;
-                        }
-
-                        numCellsVisibleOnScreen++;
-                    }
-                }
-
-                lengthBar.setMax(1);
-                if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
-                    // special case to help resolve RT-17701 and the case where we have
-                    // only a single row and it is bigger than the viewport
-                    lengthBar.setVisibleAmount(flowLength / sumCellLength);
-                } else {
-                    lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
+                    numCellsVisibleOnScreen++;
                 }
             }
 
+            lengthBar.setMax(1);
+            if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
+                    // special case to help resolve RT-17701 and the case where we have
+                // only a single row and it is bigger than the viewport
+                lengthBar.setVisibleAmount(flowLength / sumCellLength);
+            } else {
+                lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
+            }
+        }
+
+        if (lengthBar.isVisible()) {
             // Fix for RT-11873. If this isn't here, we can have a situation where
             // the scrollbar scrolls endlessly. This is possible when the cell
             // count grows as the user hits the maximal position on the scrollbar