Skip to content

Commit

Permalink
UI component bundles derive clone (bevyengine#390)
Browse files Browse the repository at this point in the history
make Draw, TextStyle, and the rest of the ui components derive clone
  • Loading branch information
ashneverdawn authored and mrk-its committed Oct 6, 2020
1 parent ada462c commit 337b526
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum RenderCommand {
}

/// A component that indicates how to draw an entity.
#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct Draw {
pub is_visible: bool,
pub is_transparent: bool,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/pipeline/render_pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl RenderPipeline {
}
}

#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct RenderPipelines {
pub pipelines: Vec<RenderPipeline>,
#[property(ignore)]
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_text/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use bevy_render::{
};
use bevy_sprite::{TextureAtlas, TextureAtlasSprite};

#[derive(Clone)]
pub struct TextStyle {
pub font_size: f32,
pub color: Color,
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_ui/src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bevy_transform::{
prelude::{Rotation, Scale, Transform, Translation},
};

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct NodeComponents {
pub node: Node,
pub style: Style,
Expand Down Expand Up @@ -62,7 +62,7 @@ impl Default for NodeComponents {
}
}

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct ImageComponents {
pub node: Node,
pub style: Style,
Expand Down Expand Up @@ -110,7 +110,7 @@ impl Default for ImageComponents {
}
}

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct TextComponents {
pub node: Node,
pub style: Style,
Expand Down Expand Up @@ -140,7 +140,7 @@ impl Default for TextComponents {
}
}

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct ButtonComponents {
pub node: Node,
pub button: Button,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ui/src/widget/button.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#[derive(Clone)]
pub struct Button;
1 change: 1 addition & 0 deletions crates/bevy_ui/src/widget/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use bevy_math::Size;
use bevy_render::texture::Texture;
use bevy_sprite::ColorMaterial;

#[derive(Clone)]
pub enum Image {
KeepAspect,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use bevy_sprite::TextureAtlas;
use bevy_text::{DrawableText, Font, FontAtlasSet, TextStyle};
use bevy_transform::prelude::Transform;

#[derive(Default)]
#[derive(Default, Clone)]
pub struct Text {
pub value: String,
pub font: Handle<Font>,
Expand Down

0 comments on commit 337b526

Please sign in to comment.