RFR: 8311527: Region.snapInnerSpace*()

Kevin Rushforth kcr at openjdk.org
Thu Sep 7 22:57:46 UTC 2023


On Thu, 7 Sep 2023 22:52:46 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> I see at least two use cases:
> 
> 1. When laying out an unsnapped container which contains snapped children.  In order to get the available (snapped) space, we'd need to floor the unsnapped size.

Even if this is a valid use case (which I'm not sure it is), I don't see that we should do anything different based on whether ot not the parent is snapped. So this doesn't motivate the need for this method.

> 2. When laying out a complex constraint layout, such as a variant of TableLayout (see for example https://github.com/andy-goryachev/FxDock/blob/master/doc/CPane.md ), where there might exist external constraints on one or more columns and/or rows, there might be a need to snap the constraint value.  How it needs to be snapped depends on the actual constraint, for example when we have a **maximum width** constraint in an otherwise unconstrained situation, we need snapInnerSpace().

Yes, if there is a complex case of layout that needs this, then it would be a good argument for adding this method. What I would want to see first, though, is an actual use case -- not a theoretical one -- that needs this method, and uses it in a way that shows it to be a generally useful method to add to the API.

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

PR Comment: https://git.openjdk.org/jfx/pull/1190#issuecomment-1710862459


More information about the openjfx-dev mailing list