On Thu, 27 Aug 2026 11:17:09 GMT, Michael Strauß <[email protected]> wrote:
> This PR is an audit of several snapping-related methods in `Region`, along > with some bug fixes. > > I've added a helper method `snapAligned()`, which does the exact same thing > as `snapSpace()`, but clearly states that the author knows that the value is > already pixel-aligned. In addition, I've renamed several local variables > around a "rawFoo" and "snappedFoo" naming scheme, so as to make it easier to > see what's what. > > This PR should probably be integrated before the other layout container PRs, > because those use the `Region` layout methods. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java line 439: > 437: */ > 438: private static double snapAligned(double value, boolean snapToPixel, > double snapScale) { > 439: return snapToPixel ? ScaledMath.round(value, snapScale) : value; does this method expects `Double.MAX_VALUE`? what would happen? modules/javafx.graphics/src/test/java/test/javafx/scene/layout/RegionTest.java line 2529: > 2527: Arguments.of(1.25, 1.25), > 2528: Arguments.of(1.5, 1.5), > 2529: Arguments.of(2.5, 2.5), I recommend including the following scales here and in the other snapping PRs: 1.0, 1.25, 1.5, 1.75, 2.0, 2.25 <img width="326" height="322" alt="Screenshot 2026-08-28 135323" src="https://github.com/user-attachments/assets/27676d2b-b204-469a-b6c8-d828e46b44d4" /> ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2278#discussion_r3884567803 PR Review Comment: https://git.openjdk.org/jfx/pull/2278#discussion_r3883967612
