Skip to content

Commit

Permalink
Don't ignore UI scale for text (#7510)
Browse files Browse the repository at this point in the history
# Objective

Fixes #7476. UI scale was being incorrectly ignored when a primary window exists.

## Solution

Always take into account UI scale, regardless of whether a primary window exists.

Tested locally on @forbjok 's minimal repro project https://github.com/forbjok/bevy_ui_repro with this patch, and the issue is fixed on my machine.
  • Loading branch information
DanielJin21 committed Feb 5, 2023
1 parent e8e6163 commit 2e53f3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ pub fn text_system(
)>,
) {
// TODO: Support window-independent scaling: https://github.com/bevyengine/bevy/issues/5621
let scale_factor = windows
let window_scale_factor = windows
.get_single()
.map(|window| window.resolution.scale_factor())
.unwrap_or(ui_scale.scale);
.unwrap_or(1.);

let scale_factor = ui_scale.scale * window_scale_factor;

let inv_scale_factor = 1. / scale_factor;

Expand Down

0 comments on commit 2e53f3b

Please sign in to comment.