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

Add Memory::area_rect #3161

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Conversation

tosti007
Copy link
Contributor

Currently, there is no way of obtaining any information on windows from Memory, even though this is in fact stored in there. This PR exposes the area::State struct as public and adds a function to obtain said State for a window.

@tosti007 tosti007 marked this pull request as draft July 14, 2023 09:02
@tosti007 tosti007 changed the title 🧢 Expose area::State in Memory 🧢 Expose area::State's Rect in Memory Jul 14, 2023
@tosti007 tosti007 marked this pull request as ready for review July 14, 2023 09:26
@tosti007 tosti007 force-pushed the memory-expose-area-size branch 3 times, most recently from b860990 to 6c693a6 Compare July 18, 2023 15:22
@emilk emilk added the egui label Aug 9, 2023
@@ -487,6 +487,11 @@ impl Memory {
pub fn reset_areas(&mut self) {
self.areas = Default::default();
}

/// Obtain the previous area rect of a window.
pub fn window_rect(&self, id: impl Into<Id>) -> Option<Rect> {
Copy link
Owner

Choose a reason for hiding this comment

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

It would be great to link to this function from the docs of Window and Area

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@tosti007 tosti007 force-pushed the memory-expose-area-size branch 2 times, most recently from 9145473 to eca56ee Compare August 16, 2023 08:03
@tosti007
Copy link
Contributor Author

I added the doc-links on Window and Area. I renamed window_rect to area_rect as it's actually generic for all areas.

@@ -21,6 +21,9 @@ use super::*;
/// ui.label("Hello World!");
/// });
/// # });
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also did a drive-by fix here.

@emilk emilk merged commit 2c7c598 into emilk:master Aug 16, 2023
18 checks passed
@emilk emilk changed the title 🧢 Expose area::State's Rect in Memory Expose area::State's Rect in Memory Sep 27, 2023
@emilk emilk changed the title Expose area::State's Rect in Memory 🧢 Expose area::State's Rect in Memory Sep 27, 2023
@emilk emilk changed the title 🧢 Expose area::State's Rect in Memory Add Memory::area_rect Sep 27, 2023
@tosti007 tosti007 deleted the memory-expose-area-size branch November 2, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants