Remove margins.rs (#4284)

# Objective

- Closes #335.
- Part of the splitting process of #3503.

## Solution

- Remove the `margins.rs` file containing the `Margins` type.

## Reasons

- It is unused inside of `bevy`.
- The `Rect`/`UiRect` is identical to the `Margins` type and is also used for margins inside of `bevy` (rename of `Rect` happens in #4276)
- Discussion in #3503.

## Changelog

### Removed

- The `Margins` type got removed.

## Migration Guide

- The `Margins` type got removed. To migrate you just have to change every occurrence of `Margins` to `UiRect`.
This commit is contained in:
KDecay 2022-03-29 22:39:18 +00:00
parent f5e53ba6f5
commit f3a61327a4
2 changed files with 1 additions and 38 deletions

View File

@ -4,7 +4,6 @@
//! This UI is laid out with the Flexbox paradigm (see <https://cssreference.io/flexbox/> ) except the vertical axis is inverted
mod flex;
mod focus;
mod margins;
mod render;
mod ui_node;
@ -15,14 +14,13 @@ pub mod widget;
use bevy_render::camera::CameraTypePlugin;
pub use flex::*;
pub use focus::*;
pub use margins::*;
pub use render::*;
pub use ui_node::*;
#[doc(hidden)]
pub mod prelude {
#[doc(hidden)]
pub use crate::{entity::*, ui_node::*, widget::Button, Interaction, Margins};
pub use crate::{entity::*, ui_node::*, widget::Button, Interaction};
}
use bevy_app::prelude::*;

View File

@ -1,35 +0,0 @@
/// Defines the margins of a UI node
#[derive(Debug, Clone)]
pub struct Margins {
/// Left margin size in pixels
pub left: f32,
/// Right margin size in pixels
pub right: f32,
/// Bottom margin size in pixels
pub bottom: f32,
/// Top margin size in pixels
pub top: f32,
}
impl Margins {
/// Creates a new Margins based on the input
pub fn new(left: f32, right: f32, bottom: f32, top: f32) -> Self {
Margins {
left,
right,
bottom,
top,
}
}
}
impl Default for Margins {
fn default() -> Self {
Margins {
left: 0.0,
right: 0.0,
bottom: 0.0,
top: 0.0,
}
}
}