Skip to content

Commit

Permalink
Removed JustifySelf
Browse files Browse the repository at this point in the history
  • Loading branch information
ickshonpe committed Mar 1, 2023
1 parent e5a6144 commit 6f32916
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 52 deletions.
19 changes: 2 additions & 17 deletions crates/bevy_ui/src/flex/convert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AlignContent, AlignItems, AlignSelf, Breadth, Display, FlexDirection, FlexWrap, JustifyContent,
JustifySelf, PositionType, Style, Val,
PositionType, Style, Val,
};
use taffy::prelude::{LengthPercentage, LengthPercentageAuto, Rect};
use taffy::style::Dimension;
Expand Down Expand Up @@ -44,7 +44,6 @@ pub fn from_style(scale_factor: f64, style: &Style) -> taffy::style::Style {
align_self: style.align_self.into(),
align_content: Some(style.align_content.into()),
justify_content: Some(style.justify_content.into()),
justify_self: style.justify_self.into(),
margin: Rect {
left: from_val(scale_factor, style.margin.left),
right: from_val(scale_factor, style.margin.right),
Expand Down Expand Up @@ -83,6 +82,7 @@ pub fn from_style(scale_factor: f64, style: &Style) -> taffy::style::Style {
width: from_breadth(scale_factor, style.gap.width),
height: from_breadth(scale_factor, style.gap.height),
},
justify_self: None,
}
}

Expand Down Expand Up @@ -165,21 +165,6 @@ impl From<JustifyContent> for taffy::style::JustifyContent {
}
}

impl From<JustifySelf> for Option<taffy::style::AlignItems> {
fn from(value: JustifySelf) -> Self {
match value {
JustifySelf::Auto => None,
JustifySelf::Start => taffy::style::AlignItems::Start.into(),
JustifySelf::End => taffy::style::AlignItems::End.into(),
JustifySelf::FlexStart => taffy::style::AlignItems::FlexStart.into(),
JustifySelf::FlexEnd => taffy::style::AlignItems::FlexEnd.into(),
JustifySelf::Center => taffy::style::AlignItems::Center.into(),
JustifySelf::Baseline => taffy::style::AlignItems::Baseline.into(),
JustifySelf::Stretch => taffy::style::AlignItems::Stretch.into(),
}
}
}

impl From<PositionType> for taffy::style::Position {
fn from(value: PositionType) -> Self {
match value {
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ impl Plugin for UiPlugin {
.register_type::<FocusPolicy>()
.register_type::<Interaction>()
.register_type::<JustifyContent>()
.register_type::<JustifySelf>()
.register_type::<Node>()
// NOTE: used by Style::aspect_ratio
.register_type::<Option<f32>>()
Expand Down
34 changes: 0 additions & 34 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,6 @@ pub struct Style {
pub align_content: AlignContent,
/// How items align according to the main axis
pub justify_content: JustifyContent,
/// How this node should be aligned in the main axis
pub justify_self: JustifySelf,
/// The amount of space around a node outside its border.
///
/// If a percentage value is used, the percentage is calculated based on the width of the parent node.
Expand Down Expand Up @@ -493,7 +491,6 @@ impl Style {
align_self: AlignSelf::DEFAULT,
align_content: AlignContent::DEFAULT,
justify_content: JustifyContent::DEFAULT,
justify_self: JustifySelf::DEFAULT,
margin: UiRect::all(Val::Px(0.)),
padding: UiRect::all(Breadth::Px(0.)),
border: UiRect::all(Breadth::Px(0.)),
Expand Down Expand Up @@ -724,37 +721,6 @@ impl Default for JustifyContent {
}
}

/// How this node should be aligned in the main axis
#[derive(Copy, Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Reflect)]
#[reflect(PartialEq, Serialize, Deserialize)]
pub enum JustifySelf {
Auto,
/// Items are packed toward the start of the axis
Start,
/// Items are packed toward the end of the axis
End,
/// Items are aligned at the start
FlexStart,
/// Items are aligned at the end
FlexEnd,
/// Items are aligned at the center
Center,
/// Items are aligned at the baseline
Baseline,
/// Items are stretched across the whole cross axis
Stretch,
}

impl JustifySelf {
pub const DEFAULT: Self = Self::FlexStart;
}

impl Default for JustifySelf {
fn default() -> Self {
Self::DEFAULT
}
}

/// Whether to show or hide overflowing items
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect, Serialize, Deserialize)]
#[reflect(PartialEq, Serialize, Deserialize)]
Expand Down

0 comments on commit 6f32916

Please sign in to comment.