RFR: 8372761: Prevent degenerate transforms for zero-size Scene/SubScene [v2]

Michael Strauß mstrauss at openjdk.org
Fri Dec 5 14:19:59 UTC 2025


On Fri, 5 Dec 2025 06:53:16 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

> Doc of [localToScreen()](https://openjfx.io/javadoc/24/javafx.graphics/javafx/scene/Node.html#localToScreen(double,double)): Transforms a point from the local coordinate space of this Node into the coordinate space of its Screen When the sub scene is of size (0, 0), then the sub scene and so it's children will not be shown on screen. Printing a valid screen coordinates with localToScreen() for nodes that are not shown on screen, seems not correct. Rather, NaN would imply that something is not correct / the node is not shown on screen.

`localToScreen` is not specified to account for something being "shown" on screen. Instead, it answers the question: given a point in the local coordinate system of a node, which point on the screen does it correspond to?

And _this_ question has a valid answer: In the limit, the screen coordinates of a point specified in a 0-size scene or a vanishingly small scene are the same. In fact, the only reason this API can't answer this question is not because of some deep lack of meaning for the 0-size case, but simply because the size of the scene appears as a denominator in the projection transform.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1992#issuecomment-3617104296


More information about the openjfx-dev mailing list