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.
This commit is contained in:
Rob Parrett 2024-08-19 14:45:28 -07:00 committed by GitHub
parent e37bf18e2b
commit 618cf7f51d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 38 deletions

View file

@ -454,7 +454,6 @@ mod tests {
right: Val::Percent(50.), right: Val::Percent(50.),
top: Val::Px(12.), top: Val::Px(12.),
bottom: Val::Auto, bottom: Val::Auto,
direction: crate::Direction::Inherit,
flex_direction: FlexDirection::ColumnReverse, flex_direction: FlexDirection::ColumnReverse,
flex_wrap: FlexWrap::WrapReverse, flex_wrap: FlexWrap::WrapReverse,
align_items: AlignItems::Baseline, align_items: AlignItems::Baseline,

View file

@ -173,13 +173,6 @@ pub struct Style {
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/overflow> /// <https://developer.mozilla.org/en-US/docs/Web/CSS/overflow>
pub overflow: 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. /// 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 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. /// - For absolutely positioned nodes, this is relative to the *parent* node's bounding box.
@ -435,7 +428,6 @@ impl Style {
right: Val::Auto, right: Val::Auto,
top: Val::Auto, top: Val::Auto,
bottom: Val::Auto, bottom: Val::Auto,
direction: Direction::DEFAULT,
flex_direction: FlexDirection::DEFAULT, flex_direction: FlexDirection::DEFAULT,
flex_wrap: FlexWrap::DEFAULT, flex_wrap: FlexWrap::DEFAULT,
align_items: AlignItems::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. /// Defines the layout model used by this node.
/// ///
/// Part of the [`Style`] component. /// Part of the [`Style`] component.