On Wed, 19 Aug 2026 08:00:57 GMT, John Hendrikx <[email protected]> wrote:
> I lost you at the point where you went to "That doesn't make the snapping API > a good idea..." -- what API? What I meant was that the current API (overriding measurement any layout methods, combined with manual snapping) is not very useful to create custom layouts. Most developers won't have an intuition of the intricate rules that is strong enough to pull it off without making mistakes (as can be clearly seen in JavaFX itself), and the failure modes of defective code are often not easily visible. Aside from that, I think that you've convinced me that "fuzzy snapping" is probably a good idea. However, not as something we should do in JavaFX itself, and neither as something we should recommend. The problem that I still have with it is that it allows off-grid values to be exposed in the scene graph; the correction is only applied when those values are consumed by the layout system itself. It does not prevent non-layout-related code from seeing the off-grid values. I can't imagine that this will be a problem for any reasonable application, but it still makes it feel a bit "ugly". I'd like to see built-in layout containers continue to expose canonical grid-aligned values. This will account for the majority of layout activity in any given JavaFX application. Fuzzy snapping would then be more like a fallback system to have custom third-party layouts (which are probably going to have defects) behave more gracefully. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2260#discussion_r3813367483
