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

Window::default_pos does not work #5314

Closed
zhatuokun opened this issue Oct 28, 2024 · 0 comments · Fixed by #5315
Closed

Window::default_pos does not work #5314

zhatuokun opened this issue Oct 28, 2024 · 0 comments · Fixed by #5315
Labels
bug Something is broken

Comments

@zhatuokun
Copy link
Contributor

Describe the bug

I want a Window to be created at the right bottom corner and then be resizable and movable. I tried using default_pos but it didn't work. fixed_pos works, but then I can't move the window afterwards.

To Reproduce

run this code

    eframe::run_simple_native("Example", eframe::NativeOptions::default(), |ctx, frame| {
        CentralPanel::default().show(ctx, |ui| {
            let window_size = Vec2::new(200.0, 200.0);

            Window::new("example")
                .pivot(Align2::LEFT_TOP)
                .min_size(window_size)
                .default_size(window_size)
                .default_pos(ui.max_rect().right_bottom() - window_size)
                .show(ctx, |ui| {
                    ui.expand_to_include_rect(ui.available_rect_before_wrap());
                    ui.label("text");
                });
        });
    })

Expected behavior

Create a Window at the right bottom corner and then be resizable and movable.

Desktop (please complete the following information):

  • OS: Window11
  • Version: 23H2
@zhatuokun zhatuokun added the bug Something is broken label Oct 28, 2024
emilk pushed a commit that referenced this issue Oct 29, 2024
Fix: Window::default_pos does not work

Issues: Since `default_size` is not applied to `area`,
`style.spacing.default_area_size` is applied, causing problems.

* Closes #5314
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
Fix: Window::default_pos does not work

Issues: Since `default_size` is not applied to `area`,
`style.spacing.default_area_size` is applied, causing problems.

* Closes emilk#5314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant