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

Dropdown: wrong window position #94

Open
maurerdietmar opened this issue Jan 4, 2022 · 2 comments
Open

Dropdown: wrong window position #94

maurerdietmar opened this issue Jan 4, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@maurerdietmar
Copy link
Collaborator

Testing on Debian bullseye, the position of the dropdown popup window is wrong. The following
patch makes it better:

diff --git a/src/dropdown.rs b/src/dropdown.rs
index 357a80e..dbd692a 100644
--- a/src/dropdown.rs
+++ b/src/dropdown.rs
@@ -33,7 +33,7 @@ impl<T: Data> Dropdown<T> {
 
     fn show_dropdown(&mut self, data: &mut T, env: &Env, ctx: &mut EventCtx) {
         let widget = (self.drop)(data, env);
-        let origin = ctx.to_screen(Point::new(0., ctx.size().height));
+        let origin = ctx.to_window(Point::new(0., ctx.size().height));
         self.window = Some(
             ctx.new_sub_window(
                 WindowConfig::default()

Horizontal position is now correct, but the windows has still the wrong vertical position (off by about the size of the window decorations).

@richard-uk1
Copy link
Collaborator

If it's an improvement, then make a PR. 🙂

If you do, could you add a TODO comment. Just copying and pasting

Horizontal position is now correct, but the windows has still the wrong vertical position (off by about the size of the window decorations).

Would be fine.

@richard-uk1 richard-uk1 added the bug Something isn't working label Jan 6, 2022
@maurerdietmar
Copy link
Collaborator Author

If it's an improvement, then make a PR.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants