Skip to content

Commit

Permalink
Ui Node Borders #7795
Browse files Browse the repository at this point in the history
  • Loading branch information
hafiidz committed Jul 20, 2023
1 parent b38efd1 commit 5cae089
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bevy_proto_backend/src/impls/bevy_impls/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use bevy::math::{Rect, Vec2};
use bevy::prelude::{BackgroundColor, Button, Label};
use bevy::reflect::{std_traits::ReflectDefault, Reflect};
use bevy::ui::{
AlignContent, AlignItems, AlignSelf, CalculatedClip, ContentSize, Direction, Display,
FlexDirection, FlexWrap, FocusPolicy, GridAutoFlow, GridPlacement, GridTrack, Interaction,
JustifyContent, JustifyItems, JustifySelf, Node, Overflow, PositionType,
AlignContent, AlignItems, AlignSelf, BorderColor, CalculatedClip, ContentSize, Direction,
Display, FlexDirection, FlexWrap, FocusPolicy, GridAutoFlow, GridPlacement, GridTrack,
Interaction, JustifyContent, JustifyItems, JustifySelf, Node, Overflow, PositionType,
RelativeCursorPosition, RepeatedGridTrack, Style, UiImage, UiRect, Val, ZIndex,
};

Expand Down Expand Up @@ -58,6 +58,20 @@ impl_external_schematic! {
}
}

impl_external_schematic! {
#[schematic(from = BorderColorInput)]
struct BorderColor();
// ---
#[derive(Reflect)]
#[reflect(Default)]
pub struct BorderColorInput(pub ProtoColor);
from_to_default! {
BorderColor,
BorderColorInput,
|value: Input| Self(value.0.into())
}
}

impl_external_schematic! {
#[schematic(from = ButtonInput)]
struct Button;
Expand Down
3 changes: 3 additions & 0 deletions src/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ pub struct ButtonBundle {
#[reflect(default)]
pub background_color: bevy_impls::ui::BackgroundColorInput,
#[reflect(default)]
pub background_color: bevy_impls::ui::BorderColorInput,
#[reflect(default)]
pub image: bevy_impls::ui::UiImageInput,
#[reflect(default)]
pub transform: Transform,
Expand All @@ -554,6 +556,7 @@ impl FromSchematicInput<ButtonBundle> for bevy::ui::node_bundles::ButtonBundle {
interaction: input.interaction.into(),
focus_policy: input.focus_policy.into(),
background_color: input.background_color.into(),
border_color: input.border_color.into(),
image: bevy::ui::UiImage::from_input(input.image, context),
transform: input.transform,
global_transform: input.global_transform,
Expand Down

0 comments on commit 5cae089

Please sign in to comment.