Skip to content

Commit

Permalink
Tidied up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ickshonpe committed Mar 1, 2023
1 parent 21fd333 commit 623c287
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions crates/bevy_ui/src/flex/convert.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
use crate::Breadth;
use crate::JustifySelf;
use crate::{
AlignContent, AlignItems, AlignSelf, Display, FlexDirection, FlexWrap, JustifyContent,
PositionType, Style, Val,
AlignContent, AlignItems, AlignSelf, Breadth, Display, FlexDirection, FlexWrap, JustifyContent,
JustifySelf, PositionType, Style, Val,
};
use taffy::prelude::LengthPercentage;
use taffy::prelude::LengthPercentageAuto;
use taffy::prelude::Rect;
use taffy::prelude::{LengthPercentage, LengthPercentageAuto, Rect};
use taffy::style::Dimension;

fn from_breadth(scale_factor: f64, breadth: Breadth) -> LengthPercentage {
match breadth {
Breadth::Percent(value) => LengthPercentage::Percent(value / 100.0),
Breadth::Px(value) => LengthPercentage::Points((scale_factor * value as f64) as f32),
}
}

fn from_val(scale_factor: f64, val: Val) -> LengthPercentageAuto {
match val {
Val::Auto => LengthPercentageAuto::Auto,
Expand All @@ -17,13 +20,6 @@ fn from_val(scale_factor: f64, val: Val) -> LengthPercentageAuto {
}
}

fn from_breadth(scale_factor: f64, breadth: Breadth) -> LengthPercentage {
match breadth {
Breadth::Percent(value) => LengthPercentage::Percent(value / 100.0),
Breadth::Px(value) => LengthPercentage::Points((scale_factor * value as f64) as f32),
}
}

fn dim_from_val(scale_factor: f64, val: Val) -> Dimension {
match val {
Val::Auto => Dimension::Auto,
Expand Down

0 comments on commit 623c287

Please sign in to comment.