On Tue, 8 Nov 2022 17:39:27 GMT, Marius Hanl <mh...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/layout/AnchorPane.java >> line 353: >> >>> 351: >>> 352: if (leftAnchor != null) { >>> 353: x = snappedLeftInset() + leftAnchor; >> >> Question: should we use unsnapped coordinates in the computations, and only >> snap at the final stage? >> >> For example, if leftAnchor is 0.5 the child will be positioned between the >> pixels, so to speak. >> >> Or is this indeed an intended functionality? > > Not 100% sure about this. It sounds somewhat logical. If we set the left > anchor to be 5. Do we expect it to be 10 with a render scale of 2 -> 200% > resolution? Not sure about render scale - it should be done elsewhere. As for snapping, I think this code might be incorrect - it should honor Region.snapToPixel setting. All the intermediary computations need to use unsnapped (original) values, then, at the last moment, call proper Region.snap*() which either rounds or not, depending on the `snapToPixel`. The only exception for this rule (of using snapped values in the intermediary computations) is to ensure some kind of specific alignment, which I believe is not the case here. ------------- PR: https://git.openjdk.org/jfx/pull/910