Register UiImageSize (#8441)

# Objective

Add `register_type` and derive `Reflect` for `UiImageSize`.

## Changelog
* Added `register_type` and derive `Reflect` for `UiImageSize`.
This commit is contained in:
ickshonpe 2023-04-30 00:48:24 +01:00 committed by GitHub
parent cb286e5b60
commit ee697f820c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -28,6 +28,7 @@ pub use layout::*;
pub use measurement::*;
pub use render::*;
pub use ui_node::*;
use widget::UiImageSize;
#[doc(hidden)]
pub mod prelude {
@ -113,6 +114,7 @@ impl Plugin for UiPlugin {
.register_type::<Style>()
.register_type::<BackgroundColor>()
.register_type::<UiImage>()
.register_type::<UiImageSize>()
.register_type::<Val>()
.register_type::<widget::Button>()
.register_type::<widget::Label>()

View File

@ -5,17 +5,20 @@ use bevy_ecs::query::Without;
use bevy_ecs::{
prelude::Component,
query::With,
reflect::ReflectComponent,
system::{Query, Res},
};
use bevy_math::Vec2;
use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect};
use bevy_render::texture::Image;
#[cfg(feature = "bevy_text")]
use bevy_text::Text;
/// The size of the image in pixels
/// The size of the image in physical pixels
///
/// This field is set automatically
#[derive(Component, Copy, Clone, Debug, Default)]
/// This field is set automatically by `update_image_calculated_size_system`
#[derive(Component, Debug, Copy, Clone, Default, Reflect, FromReflect)]
#[reflect(Component, Default, FromReflect)]
pub struct UiImageSize {
size: Vec2,
}