RFR: 8295078: TextField blurry when inside an TitledPane -> AnchorPane [v4]
Marius Hanl
mhanl at openjdk.org
Thu Dec 8 19:10:47 UTC 2022
On Thu, 8 Dec 2022 18:29:48 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
>> The problem here is, that the `AnchorPane` does not use its snapped insets.
>> Therefore, the fix is to replace all `getInsets().getXXX` calls with their corresponding `snappedXXXInset()` methods.
>>
>> Note: The reason the `AnchorPane` inside a `TitledPane` is blurry in the first place is because a `TitledPane` applies padding to its content.
>> Line 2995 in `modena.css`:
>>
>> .titled-pane > .content > AnchorPane {
>> -fx-padding: 0.8em;
>> }
>>
>> which translates to 9.6px.
>>
>> EDIT: This is btw a good example of the JUnit 5 feature `@ParameterizedTest` with `@ValueSource`
>
> Marius Hanl has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
>
> - 8295078: Snap anchors as well
> - Merge branch 'master' of https://github.com/openjdk/jfx into 8295078-textfield-blurry
>
> Conflicts:
> modules/javafx.graphics/src/test/java/test/javafx/scene/layout/AnchorPaneTest.java
> - 8295078: Replace JUnit4 with Junit5 imports
> - 8295078: Adjusted Copyright year
> - 8295078: TextField blurry when inside an TitledPane -> AnchorPane
I thought about this one more time.
Example:
- render scale of 1.25 (125%).
- `Control` with a width of 200px
- `left inset` = 10, `right inset` = 15
- `left anchor` = 10, `right anchor` = 15
Now the UI would look like this currently:
[`Left inset` = 10.4][`Left anchor` = 10.4][`Control` = 148.8][`Right anchor` = 15.2][`Right inset` = 15.2]
Control width is calculated like this: 200 - 10.4 - 15.2 - 10.4 - 15.2 = 148.8
If we would not snap intermediate values, the left side (inset + anchor) would be 20 instead of 20.8.
The right side would still be 30.4.
Thinking about this again, isn't the current behaviour what we would expect from the layout with a scale of 1.25?
Snapping 'intermediate' values seems logical to me (current vehaviour), but maybe I'm missing something.
But we should avoid snapping things more than one time.
-------------
PR: https://git.openjdk.org/jfx/pull/910
More information about the openjfx-dev
mailing list