You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stumbling across this after finding the warning in the comment of Window::current_pos(...) reads ... If the window is movable it is up to you to keep track of where it moved to!. Additionally, if we use Window::current_pos(...) the response does not include the updated Rect for the in-progress drag. So we can't grab it from the response.
Initial reaction to seeing that was supply current pos, run immediate render/interaction, then update state position with window's new position. It was not straight forward to retrieve this. My first hope was to use the window response InnerResponse.response.drag_delta() but that does not expose window drags, maybe when using current_pos(...).
My goal was to link the window position to another item's position (in my app's "edit mode", I create the window. In "view mode" I use an Area. I want the window to be created where the area was, and vice-versa.)
I arrived at this implementation for now:
let window_response = Window::new("Some window").id(window_id).current_pos(current_window_pos);let new_window_pos = ctx.memory(|mem| {
mem.area_rect(window_id).map(|rect| rect.center()).unwrap_or(current_window_pos)});// Assign new window pos back to your state somehow.
Hi
I would like to know the position of all egui windows within my application like it is done in
memory_ui
.To retrieve the list of window area,
memory_ui
has access to theareas
field inMemory
struct which is not public:egui/egui/src/context.rs
Lines 866 to 888 in 60fd709
used_rect()
function is public and almost does the job, but it returns the union of all the areas and not a list of areas:egui/egui/src/context.rs
Lines 644 to 650 in 60fd709
Is there any other way to get this information?
The text was updated successfully, but these errors were encountered: