From 0bae5bb8f44dde96e47316bbc401c418ec251f76 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 5 Jan 2022 00:49:20 +0000 Subject: [PATCH] Remove dead anchor.rs code (#3551) # Objective - As noticed by @sheepyhead in #3526, `anchor.rs` is completely unused. ## Solution - Anchors away! --- crates/bevy_ui/src/anchors.rs | 46 ----------------------------------- crates/bevy_ui/src/lib.rs | 4 +-- 2 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 crates/bevy_ui/src/anchors.rs diff --git a/crates/bevy_ui/src/anchors.rs b/crates/bevy_ui/src/anchors.rs deleted file mode 100644 index 0e3c5c5274..0000000000 --- a/crates/bevy_ui/src/anchors.rs +++ /dev/null @@ -1,46 +0,0 @@ -#[derive(Debug, Clone)] -pub struct Anchors { - pub left: f32, - pub right: f32, - pub bottom: f32, - pub top: f32, -} - -impl Anchors { - pub const BOTTOM_FULL: Anchors = Anchors::new(0.0, 1.0, 0.0, 0.0); - pub const BOTTOM_LEFT: Anchors = Anchors::new(0.0, 0.0, 0.0, 0.0); - pub const BOTTOM_RIGHT: Anchors = Anchors::new(1.0, 1.0, 0.0, 0.0); - pub const CENTER: Anchors = Anchors::new(0.5, 0.5, 0.5, 0.5); - pub const CENTER_BOTTOM: Anchors = Anchors::new(0.5, 0.5, 0.0, 0.0); - pub const CENTER_FULL_HORIZONTAL: Anchors = Anchors::new(0.0, 1.0, 0.5, 0.5); - pub const CENTER_FULL_VERTICAL: Anchors = Anchors::new(0.5, 0.5, 0.0, 1.0); - pub const CENTER_LEFT: Anchors = Anchors::new(0.0, 0.0, 0.5, 0.5); - pub const CENTER_RIGHT: Anchors = Anchors::new(1.0, 1.0, 0.5, 0.5); - pub const CENTER_TOP: Anchors = Anchors::new(0.5, 0.5, 1.0, 1.0); - pub const FULL: Anchors = Anchors::new(0.0, 1.0, 0.0, 1.0); - pub const LEFT_FULL: Anchors = Anchors::new(0.0, 0.0, 0.0, 1.0); - pub const RIGHT_FULL: Anchors = Anchors::new(1.0, 1.0, 0.0, 1.0); - pub const TOP_FULL: Anchors = Anchors::new(0.0, 1.0, 1.0, 1.0); - pub const TOP_LEFT: Anchors = Anchors::new(0.0, 0.0, 1.0, 1.0); - pub const TOP_RIGHT: Anchors = Anchors::new(1.0, 1.0, 1.0, 1.0); - - pub const fn new(left: f32, right: f32, bottom: f32, top: f32) -> Self { - Anchors { - left, - right, - bottom, - top, - } - } -} - -impl Default for Anchors { - fn default() -> Self { - Anchors { - left: 0.0, - right: 0.0, - bottom: 0.0, - top: 0.0, - } - } -} diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 2a3ef6b878..1f451fa0cd 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -1,4 +1,3 @@ -mod anchors; mod flex; mod focus; mod margins; @@ -9,7 +8,6 @@ pub mod entity; pub mod update; pub mod widget; -pub use anchors::*; pub use flex::*; pub use focus::*; pub use margins::*; @@ -18,7 +16,7 @@ pub use ui_node::*; pub mod prelude { #[doc(hidden)] - pub use crate::{entity::*, ui_node::*, widget::Button, Anchors, Interaction, Margins}; + pub use crate::{entity::*, ui_node::*, widget::Button, Interaction, Margins}; } use bevy_app::prelude::*;