Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bevy_sprite::Rect is not the same as bevy_math::Rect #335

Closed
tatref opened this issue Aug 24, 2020 · 1 comment
Closed

bevy_sprite::Rect is not the same as bevy_math::Rect #335

tatref opened this issue Aug 24, 2020 · 1 comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Feature A new feature, making something new possible

Comments

@tatref
Copy link

tatref commented Aug 24, 2020

These 2 Rects are not compatible. It's also misleading, because bevy_math::Rect is in the prelude.

Could they be merged together? Should they?

@Moxinilian Moxinilian added C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Feature A new feature, making something new possible labels Aug 24, 2020
@JonahPlusPlus
Copy link
Contributor

JonahPlusPlus commented Aug 27, 2020

I don't think they should be merged together since they measure different things. bevy_sprite::Rect is capable of defining the width and height of a rectangle, while bevy_math::Rect defines the location of its sides. In this sense, bevy_sprite::Rect is more like a bevy_math::Size with a location. I also think it is misleading,and one should be renamed. I think bevy_ui::Margins should be removed and replace bevy_math::Rect since they are the same thing. But first, someone who is more involved should review this before making a change, since there is probably a reason it wasn't done already.

@bors bors bot closed this as completed in f3a6132 Mar 29, 2022
bors bot pushed a commit that referenced this issue Apr 25, 2022
# Objective

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

## Solution

- Move `Rect` to `bevy_ui` and rename it to `UiRect`.

## Reasons

- `Rect` is only used in `bevy_ui` and therefore calling it `UiRect` makes the intent clearer.
- We have two types that are called `Rect` currently and it's missleading (see `bevy_sprite::Rect` and #335).
- Discussion in #3503.

## Changelog

### Changed

- The `Rect` type got moved from `bevy_math` to `bevy_ui` and renamed to `UiRect`.

## Migration Guide

- The `Rect` type got renamed to `UiRect`. To migrate you just have to change every occurrence of `Rect` to `UiRect`.

Co-authored-by: KDecay <KDecayMusic@protonmail.com>
exjam pushed a commit to exjam/bevy that referenced this issue May 22, 2022
# Objective

- Closes bevyengine#335.
- Related bevyengine#4285.
- Part of the splitting process of bevyengine#3503.

## Solution

- Move `Rect` to `bevy_ui` and rename it to `UiRect`.

## Reasons

- `Rect` is only used in `bevy_ui` and therefore calling it `UiRect` makes the intent clearer.
- We have two types that are called `Rect` currently and it's missleading (see `bevy_sprite::Rect` and bevyengine#335).
- Discussion in bevyengine#3503.

## Changelog

### Changed

- The `Rect` type got moved from `bevy_math` to `bevy_ui` and renamed to `UiRect`.

## Migration Guide

- The `Rect` type got renamed to `UiRect`. To migrate you just have to change every occurrence of `Rect` to `UiRect`.

Co-authored-by: KDecay <KDecayMusic@protonmail.com>
aevyrie pushed a commit to aevyrie/bevy that referenced this issue Jun 7, 2022
# Objective

- Closes bevyengine#335.
- Part of the splitting process of bevyengine#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 bevyengine#4276)
- Discussion in bevyengine#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`.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Closes bevyengine#335.
- Part of the splitting process of bevyengine#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 bevyengine#4276)
- Discussion in bevyengine#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`.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Closes bevyengine#335.
- Related bevyengine#4285.
- Part of the splitting process of bevyengine#3503.

## Solution

- Move `Rect` to `bevy_ui` and rename it to `UiRect`.

## Reasons

- `Rect` is only used in `bevy_ui` and therefore calling it `UiRect` makes the intent clearer.
- We have two types that are called `Rect` currently and it's missleading (see `bevy_sprite::Rect` and bevyengine#335).
- Discussion in bevyengine#3503.

## Changelog

### Changed

- The `Rect` type got moved from `bevy_math` to `bevy_ui` and renamed to `UiRect`.

## Migration Guide

- The `Rect` type got renamed to `UiRect`. To migrate you just have to change every occurrence of `Rect` to `UiRect`.

Co-authored-by: KDecay <KDecayMusic@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Feature A new feature, making something new possible
Projects
None yet
3 participants