Merge branch 'main' into main

This commit is contained in:
Nadav Nissim 2024-11-27 12:55:17 +02:00 committed by GitHub
commit 012483675d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 15 deletions

View File

@ -49,7 +49,7 @@ image = { version = "0.25.2", default-features = false }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu = { version = "23", default-features = false }
wgpu = { version = "23.0.1", default-features = false }
serde = { version = "1", features = ["derive"] }
derive_more = { version = "1", default-features = false, features = [
"error",

View File

@ -24,7 +24,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu = { version = "23", default-features = false }
wgpu = { version = "23.0.1", default-features = false }
serde = { version = "1", features = ["derive"] }
hexasphere = "15.0"
derive_more = { version = "1", default-features = false, features = [

View File

@ -68,7 +68,7 @@ codespan-reporting = "0.11.0"
# It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm.
# When the 'atomics' feature is enabled `fragile-send-sync-non-atomic` does nothing
# and Bevy instead wraps `wgpu` types to verify they are not used off their origin thread.
wgpu = { version = "23", default-features = false, features = [
wgpu = { version = "23.0.1", default-features = false, features = [
"wgsl",
"dx12",
"metal",

View File

@ -107,6 +107,12 @@ impl TextPipeline {
computed.entities.clear();
for (span_index, (entity, depth, span, text_font, color)) in text_spans.enumerate() {
// Save this span entity in the computed text block.
computed.entities.push(TextEntity { entity, depth });
if span.is_empty() {
continue;
}
// Return early if a font is not loaded yet.
if !fonts.contains(text_font.font.id()) {
spans.clear();
@ -122,9 +128,6 @@ impl TextPipeline {
return Err(TextError::NoSuchFont);
}
// Save this span entity in the computed text block.
computed.entities.push(TextEntity { entity, depth });
// Get max font size for use in cosmic Metrics.
font_size = font_size.max(text_font.font_size);

View File

@ -197,16 +197,19 @@ pub fn ui_focus_system(
else {
return None;
};
let window = windows.get(window_ref.entity()).ok()?;
let viewport_position = camera
.physical_viewport_rect()
.map(|rect| rect.min.as_vec2())
.unwrap_or_default();
windows
.get(window_ref.entity())
.ok()
.and_then(Window::physical_cursor_position)
.or_else(|| touches_input.first_pressed_position())
window
.physical_cursor_position()
.or_else(|| {
touches_input
.first_pressed_position()
.map(|pos| pos * window.scale_factor())
})
.map(|cursor_position| (entity, cursor_position - viewport_position))
})
.collect();

View File

@ -2191,10 +2191,10 @@ impl BorderRadius {
bottom_left: f32,
) -> Self {
Self {
top_left: Val::Px(top_left),
top_right: Val::Px(top_right),
bottom_right: Val::Px(bottom_right),
bottom_left: Val::Px(bottom_left),
top_left: Val::Percent(top_left),
top_right: Val::Percent(top_right),
bottom_right: Val::Percent(bottom_right),
bottom_left: Val::Percent(bottom_left),
}
}