-
Bug
-
Resolution: Unresolved
-
P4
-
jfx15
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 onJDK-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.
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
- relates to
-
JDK-8253597 TreeTableView: must select leaf row on click into indentation region
- Resolved