bevy/crates/bevy_ui/src/camera_config.rs
Benoît Vermont 150a3572bd Fix UiCameraConfig doc (link to the Camera page) (#6969)
The Camera link in the UiCameraConfig was not rendered properly by the documentation.

# Objective

- In the UiCameraConfig page (https://docs.rs/bevy/latest/bevy/prelude/struct.UiCameraConfig.html), a link to the Camera page (https://docs.rs/bevy/latest/bevy/render/camera/struct.Camera.html) is broken.

## Solution

- It seems that when using URL fragment specifiers, backtick should not be used. It might be an issue of rust itself. Replacing the URL fragment specifier `[`Camera`]: bevy_render:📷:Camera` with `[Camera]: bevy_render:📷:Camera` solves this.
2022-12-20 23:32:04 +00:00

37 lines
988 B
Rust

//! Configuration for cameras related to UI.
use bevy_ecs::component::Component;
use bevy_ecs::prelude::With;
use bevy_ecs::query::QueryItem;
use bevy_render::camera::Camera;
use bevy_render::extract_component::ExtractComponent;
/// Configuration for cameras related to UI.
///
/// When a [`Camera`] doesn't have the [`UiCameraConfig`] component,
/// it will display the UI by default.
///
#[derive(Component, Clone)]
pub struct UiCameraConfig {
/// Whether to output UI to this camera view.
///
/// When a `Camera` doesn't have the [`UiCameraConfig`] component,
/// it will display the UI by default.
pub show_ui: bool,
}
impl Default for UiCameraConfig {
fn default() -> Self {
Self { show_ui: true }
}
}
impl ExtractComponent for UiCameraConfig {
type Query = &'static Self;
type Filter = With<Camera>;
type Out = Self;
fn extract_component(item: QueryItem<'_, Self::Query>) -> Option<Self> {
Some(item.clone())
}
}