Don't ignore UI scale for text (#7510)

# 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.
This commit is contained in:
DanielJin21 2023-02-05 18:15:22 +00:00
parent e8e61631b7
commit 2e53f3b775

View file

@ -65,10 +65,12 @@ pub fn text_system(
)>, )>,
) { ) {
// TODO: Support window-independent scaling: https://github.com/bevyengine/bevy/issues/5621 // TODO: Support window-independent scaling: https://github.com/bevyengine/bevy/issues/5621
let scale_factor = windows let window_scale_factor = windows
.get_single() .get_single()
.map(|window| window.resolution.scale_factor()) .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; let inv_scale_factor = 1. / scale_factor;