RFR: 8295078: TextField blurry when inside an TitledPane -> AnchorPane [v4]
John Hendrikx
jhendrikx at openjdk.org
Fri May 12 07:46:57 UTC 2023
On Thu, 11 May 2023 23:00:34 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Well, given that we (should) snap everything including the calculation of the width, I expected that the `areaWidth` and `height`, which are basically `getWidth` and `getHeight` are already snapped.
>> That was at least my thinking back then, not sure now. I need to check everything again since this was a while ago. :)
>
> I wonder.
>
> This might be a contrived example: what would happen if the parent containing the TitledPane is unsnapped, but TitledPane is?
> In this case getWidth() may not be snapped since the titled pane has been laid out by an unsnapped parent.
I think once there is an unsnapped parent, all children should probably also be unsnapped (ie. the property should work like the visible property; if I turn it off for one parent, all children become invisible/unsnapped).
There would otherwise be little point in setting a parent to unsnapped if one didn't also turn off snapping on all the children.
Note that we tested what happens when you put snapped content in an unsnapped container; currently this results in all children to be misaligned (not pixel aligned). I think that's the only real solution, as trying to resnap your positions when your parent container is misaligning you would otherwise need to introduce some kind of flexible border that "absorbs" some of the misalignment so the rest of the content can be snapped again...
Basically, there are three strategies for children when dealing with an unsnapped parent:
- Just do snapping as normal (JavaFX currently) and when the parent translation is added, all final positions will be shifted by an unsnapped amount resulting in all calculations (even though they used snapping logic) to be in the "wrong" positions
- Ignore snapping when a parent is unsnapped and use standard calculations
- Somehow try to resnap content taking the parent misalignment into account; this is going to cause visual artifacts as the parent is moved, and requires some kind of flexible border
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/910#discussion_r1192025301
More information about the openjfx-dev
mailing list