Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276313

ScrollPane scroll delta incorrectly depends on content height

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: openjfx17
    • Fix Version/s: openjfx18
    • Component/s: javafx
    • Labels:
      None

      Description

      The amount by which a ScrollPane scrolls its content when receiving a SCROLL event incorrectly depends on the height of its content.

      For example, if the content height is 500 and the ScrollPane height is 100, the scroll delta is sufficiently large. However, when the content is only slightly larger than the ScrollPane, the scroll delta becomes increasingly small.

      To reproduce the problem, run the following program and test the following steps:

      1. Adjust the window size such that the ScrollPane is very small (and consequently its scroll bar has a large scroll range). Now scroll using the mouse wheel and note the delta printed to the console.

      2. Adjust the window size such that the ScrollPane is only slightly smaller than its content. Scroll using the mouse wheel and compare the delta to the first step. You will observe that the delta becomes increasingly small.


          @Override
          public void start(Stage primaryStage) {
              var content = new Rectangle();
              content.setHeight(500);
              content.setWidth(100);

              var root = new ScrollPane();
              root.setContent(content);
              root.vvalueProperty().addListener((o, ov, nv) ->
                  System.out.println(content.getLocalToSceneTransform().transform(0, 0).getY()));

              primaryStage.setScene(new Scene(root));
              primaryStage.setHeight(390);
              primaryStage.show();
          }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mstrauss Michael Strauß
              Reporter:
              mstrauss Michael Strauß
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: