Skip to content

Commit

Permalink
Remove useless Direction field (#14793)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
rparrett committed Aug 19, 2024
1 parent e37bf18 commit 618cf7f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
1 change: 0 additions & 1 deletion crates/bevy_ui/src/layout/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
37 changes: 0 additions & 37 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ pub struct Style {
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/overflow>
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.
///
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/direction>
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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 618cf7f

Please sign in to comment.