From 618cf7f51d667afa00f664a22b62bb43ba5547ad Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Mon, 19 Aug 2024 14:45:28 -0700 Subject: [PATCH] Remove useless `Direction` field (#14793) # Objective Delete some code that isn't actually doing anything. This was actually discovered way back in this obsolete PR: #5513. Also Fixes #6286 ## Solution Delete it ## Alternatives Make `Direction` do things. But it's not totally clear to me if it's possible to override cosmic-text's unicode bidi stuff. ## Migration Guide `Style` no longer has a `direction` field, and `Direction` has been deleted. They didn't do anything, so you can delete any references to them as well. --- crates/bevy_ui/src/layout/convert.rs | 1 - crates/bevy_ui/src/ui_node.rs | 37 ---------------------------- 2 files changed, 38 deletions(-) diff --git a/crates/bevy_ui/src/layout/convert.rs b/crates/bevy_ui/src/layout/convert.rs index 8a4a1ae95e..240f899656 100644 --- a/crates/bevy_ui/src/layout/convert.rs +++ b/crates/bevy_ui/src/layout/convert.rs @@ -454,7 +454,6 @@ mod tests { right: Val::Percent(50.), top: Val::Px(12.), bottom: Val::Auto, - direction: crate::Direction::Inherit, flex_direction: FlexDirection::ColumnReverse, flex_wrap: FlexWrap::WrapReverse, align_items: AlignItems::Baseline, diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 766b86e433..fb285823b3 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -173,13 +173,6 @@ pub struct Style { /// pub overflow: Overflow, - /// Defines the text direction. For example, English is written LTR (left-to-right) while Arabic is written RTL (right-to-left). - /// - /// Note: the corresponding CSS property also affects box layout order, but this isn't yet implemented in Bevy. - /// - /// - pub direction: Direction, - /// The horizontal position of the left edge of the node. /// - For relatively positioned nodes, this is relative to the node's position as computed during regular layout. /// - For absolutely positioned nodes, this is relative to the *parent* node's bounding box. @@ -435,7 +428,6 @@ impl Style { right: Val::Auto, top: Val::Auto, bottom: Val::Auto, - direction: Direction::DEFAULT, flex_direction: FlexDirection::DEFAULT, flex_wrap: FlexWrap::DEFAULT, align_items: AlignItems::DEFAULT, @@ -730,35 +722,6 @@ impl Default for JustifyContent { } } -/// Defines the text direction. -/// -/// For example, English is written LTR (left-to-right) while Arabic is written RTL (right-to-left). -#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] -#[cfg_attr( - feature = "serialize", - derive(serde::Serialize, serde::Deserialize), - reflect(Serialize, Deserialize) -)] -pub enum Direction { - /// Inherit from parent node. - Inherit, - /// Text is written left to right. - LeftToRight, - /// Text is written right to left. - RightToLeft, -} - -impl Direction { - pub const DEFAULT: Self = Self::Inherit; -} - -impl Default for Direction { - fn default() -> Self { - Self::DEFAULT - } -} - /// Defines the layout model used by this node. /// /// Part of the [`Style`] component.