You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code launches a new window on my primary monitor, which has a scale factor of 2.5 (3840x2160):
Upon moving the window to my secondary monitor, which has a scale factor of 1.0 (1920x1080), I expect the following result (screenshot taken after applying a workaround, discussed below):
What actually happened
Instead, the result upon dragging the window to the secondary monitor with scale factor 1.0 shows the text incorrectly scaled:
Additional information
While attempting to implement a manual fix by adding a system that automatically scaled text font sizes based on the window scale factor, I stumbled across an unexpected workaround for the issue. Adding the following system fixes text scaling -- it's the smallest possible system I could find that fixes the issue.
// (in App::build()).add_system(poke_text_sections_to_fix_window_scale_factors.system())// and the system:/// For some reason, text scaling can be fixed as the window auto-adjusts to the scale factor of the current monitor by poking the text components *mutably*.////// This may be from some kind of ordering issue with an internal system that checks for window scale factor changes, or some lazy-state bug that is fixed via mutable access?fnpoke_text_sections_to_fix_window_scale_factors(query:Query<&mutText>){
query.for_each_mut(|mut text| {for _section in&mut text.sections{}})}
I believe #1132 may be related to this issue; it's the most recent change I can find related to text scaling. My best guess is that adding a system that mutably runs a query on Text components either updates lazy state necessary for "automatic" text scaling to kick in, or possibly changes the order of Text system updates to allow automatic text scaling to function correctly.
The text was updated successfully, but these errors were encountered:
So it seems like the bug is "Text isn't re-rendered when scale factor changes."
Nice analysis! A bandaid for this is likely very quick, but this smells like we have bad component boundaries and I'd like to see if we can resolve the root cause as part of the UI focus area for 0.6.
Bevy version
bf053218bf394abc27897bd90aa338bb3cd580f9
Operating system & version
Windows 10.
What you did
Constructed this variation of the ui.rs example:
What you expected to happen
This code launches a new window on my primary monitor, which has a scale factor of 2.5 (3840x2160):
Upon moving the window to my secondary monitor, which has a scale factor of 1.0 (1920x1080), I expect the following result (screenshot taken after applying a workaround, discussed below):
What actually happened
Instead, the result upon dragging the window to the secondary monitor with scale factor 1.0 shows the text incorrectly scaled:
Additional information
While attempting to implement a manual fix by adding a system that automatically scaled text font sizes based on the window scale factor, I stumbled across an unexpected workaround for the issue. Adding the following system fixes text scaling -- it's the smallest possible system I could find that fixes the issue.
I believe #1132 may be related to this issue; it's the most recent change I can find related to text scaling. My best guess is that adding a system that mutably runs a query on Text components either updates lazy state necessary for "automatic" text scaling to kick in, or possibly changes the order of Text system updates to allow automatic text scaling to function correctly.
The text was updated successfully, but these errors were encountered: