mirror of
https://github.com/bevyengine/bevy
synced 2024-12-27 13:33:08 +00:00
150a3572bd
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.
37 lines
988 B
Rust
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())
|
|
}
|
|
}
|