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

Rename Val evaluate to resolve and implement viewport variant support #9568

Merged
merged 13 commits into from Aug 29, 2023

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Aug 25, 2023

Objective

Rename Val's evaluate method to resolve.

Implement resolve support for Val's viewport variants.

fixes #9535


Changelog

bevy_ui::ui_node::Val:

  • Renamed the following methods and added a viewport_size parameter:
    • evaluate to resolve
    • try_add_with_size to try_add_with_context
    • try_add_assign_with_size to try_add_assign_with_context
    • try_sub_with_size to try_sub_with_context
    • try_sub_assign_with_size to try_sub_assign_with_context
  • Implemented resolve support for Val's viewport coordinate types

Migration Guide

  • Renamed the following Val methods and added a viewport_size parameter:
    • evaluate to resolve
    • try_add_with_size to try_add_with_context
    • try_add_assign_with_size to try_add_assign_with_context
    • try_sub_with_size to try_sub_with_context
    • try_sub_assign_with_size to try_sub_assign_with_context

* ExtractUiNode
* ExtractUiNodeBorder
* ExtractUiNodeText
* ExtractUiNodeAtlasImage
These are added to the relevant UI node bundles.

The UI's extraction functions now have query filters that allow selective extraction of UI node entities:
* `extract_uinode` has filter `With<ExtractUiNode>`
* `extract_uinode_borders` has filter `With<ExtractUiNodeBorder>`
* `extract_text_uinodes` has filter `With<ExtractUiNodeText>`
* `extract_atlas_uinodes` has filter `With<ExtractUiNodeAtlasImage>`
* Renamed `_with_size` functions to `_with_context`

* Added a `viewport_size` parameter to its methods:
- `evaluate`
- `try_add_with_context`
- `try_add_assign_with_context`
- `try_sub_with_context`
- `try_sub_assign_with_context`

* Added support for the viewport `Val` variants to `evaluate`
@ickshonpe
Copy link
Contributor Author

ickshonpe commented Aug 25, 2023

Maybe both evaluate and eval are wrong, resolve seems more idiomatic.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A simple quality-of-life change that makes Bevy easier to use C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide labels Aug 25, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve is a much better name. Code changes look good though!

@ickshonpe ickshonpe changed the title Add eval support for Val's viewport variants Rename Val evaluate to resolve and implement support for the viewport variants Aug 25, 2023
@ickshonpe ickshonpe changed the title Rename Val evaluate to resolve and implement support for the viewport variants Rename Val evaluate to resolve and implement viewport variant support Aug 25, 2023
@alice-i-cecile alice-i-cecile added this to the 0.12 milestone Aug 25, 2023
Copy link
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I've left a few suggestions around docs/naming.

crates/bevy_ui/src/ui_node.rs Outdated Show resolved Hide resolved
crates/bevy_ui/src/ui_node.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Aug 29, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 29, 2023
Merged via the queue into bevyengine:main with commit 64dcaf0 Aug 29, 2023
21 checks passed
@cart cart mentioned this pull request Oct 13, 2023
43 tasks
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
…upport (bevyengine#9568)

# Objective

Rename `Val`'s `evaluate` method to `resolve`.

Implement `resolve` support for `Val`'s viewport variants.

fixes bevyengine#9535

---

## Changelog

`bevy_ui::ui_node::Val`:
* Renamed the following methods and added a `viewport_size` parameter:
   - `evaluate` to `resolve`
   - `try_add_with_size` to `try_add_with_context`
   - `try_add_assign_with_size` to `try_add_assign_with_context`
   - `try_sub_with_size` to `try_sub_with_context`
   - `try_sub_assign_with_size` to `try_sub_assign_with_context`
* Implemented `resolve` support for `Val`'s viewport coordinate types

## Migration Guide
* Renamed the following `Val` methods and added a `viewport_size`
parameter:
   - `evaluate` to `resolve`
   - `try_add_with_size` to `try_add_with_context`
   - `try_add_assign_with_size` to `try_add_assign_with_context`
   - `try_sub_with_size` to `try_sub_with_context`
   - `try_sub_assign_with_size` to `try_sub_assign_with_context`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the Val::evaluate function to support viewport coordinates
3 participants