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

MouseEventFirer: must not fire event with incorrect coordinates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: openjfx15
    • Fix Version/s: tbd
    • Component/s: javafx

      Description

      Happens if either delta != 0 or the target not located in the top-left corner of the scene. Test below fails:

          public void testStandalone() {
              Button button = new Button("just a button nothing fancy");
              // location (relative to center of node) to fire at
              double deltaX = 20;
              double deltaY = 5;
              button.setOnMousePressed(mouse -> {
                  // local coordinates
                  double centerX = button.getWidth() / 2;
                  double centerY = button.getHeight() / 2;
                  assertEquals("local X", centerX + deltaX, mouse.getX(), 0.5);
                  assertEquals("local Y", centerY + deltaY, mouse.getY(), 0.5);
                  
                  Point2D sceneP = button.localToScene(mouse.getX(), mouse.getY());
                  assertEquals("scene X", sceneP.getX(), mouse.getSceneX(), 0.5);
                  assertEquals("scene Y", sceneP.getY(), mouse.getSceneY(), 0.5);
                  
                  Point2D screenP = button.localToScreen(mouse.getX(), mouse.getY());
                  assertEquals("screen X", screenP.getX(), mouse.getScreenX(), 0.5);
                  assertEquals("screen Y", screenP.getY(), mouse.getScreenY(), 0.5);
              });
              MouseEventFirer firer = new MouseEventFirer(button);
              firer.fireMousePressed(deltaX, deltaY);
          }

      Bubbled up while working on JDK-8253597 (trying to fire events into the indentation region of a treeTable leaf). The fix of that one will include a temporary hot fix (alternative event creation path) for this. Still needs a deeper look, though.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              fastegal Jeanette Winzenburg
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: