bevy/examples/window
ickshonpe a6144e3e5c
extract_text_shadows camera query fix (#17930)
# Objective

`extract_text_shadows` was still using `UiTargetCamera` and
`DefaultUiCamera` for UI camera resolution, which no longer always
selects the right camera.

To see this modify the last lines of the `multiple_windows` example
from:
```rust
    commands.spawn((
        Text::new("First window"),
        node.clone(),
        // Since we are using multiple cameras, we need to specify which camera UI should be rendered to
        UiTargetCamera(first_window_camera),
    ));

    commands.spawn((
        Text::new("Second window"),
        node,
        UiTargetCamera(second_window_camera),
    ));
```
to:
```rust
    commands
        .spawn((
            node.clone(),
            // Since we are using multiple cameras, we need to specify which camera UI should be rendered to
            UiTargetCamera(first_window_camera),
        ))
        .with_child((Text::new("First window"), TextShadow::default()));

    commands
        .spawn((node, UiTargetCamera(second_window_camera)))
        .with_child((Text::new("Second window"), TextShadow::default()));
```

which results in the shadow that is meant to be displayed for the
"Second Window" label instead being written over the first:

<img width="800" alt="first_window_label"
src="https://github.com/user-attachments/assets/2eebccba-5749-4064-bb1c-e4f25ff0baf7">

## Solution
Remove the `UiTargetCamera` query and the `default_camera` parameter
from `extract_text_shadows` and use `UiCameraMap` with
`ComputedNodeTarget` instead.

## Testing
The `multiple_windows` example for this PR has been updated to add text
shadow to the window labels. You should see that it displays the "Second
Window" label's shadow correctly now.
2025-03-10 21:22:14 +00:00
..
clear_color.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
custom_cursor_image.rs Make CustomCursor variants CustomCursorImage/CustomCursorUrl structs (#17518) 2025-01-24 05:39:04 +00:00
custom_user_event.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
low_power.rs Renamed EventWriter::send methods to write. (#17977) 2025-02-23 21:18:52 +00:00
monitor_info.rs Rename TargetCamera to UiTargetCamera (#17403) 2025-01-19 19:56:57 +00:00
multiple_windows.rs extract_text_shadows camera query fix (#17930) 2025-03-10 21:22:14 +00:00
scale_factor_override.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
screenshot.rs simplify example, replace get_single to Single Query (#16187) 2024-11-01 18:25:42 +00:00
transparent_window.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
window_drag_move.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
window_resizing.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
window_settings.rs Make CustomCursor variants CustomCursorImage/CustomCursorUrl structs (#17518) 2025-01-24 05:39:04 +00:00