Skip to content

Conversation

@Creative0708
Copy link
Contributor

The menu buttons, combo box menus, and tooltips don't take layer transforms into account when placing their popups, resulting in popups being placed in the wrong location.

This PR makes the popups take layer transforms into account, transforming the positions before displaying them on screen. I implemented this fix for menu buttons, combo boxes, and tooltips; let me know if there's anything I missed.
Scaling of the popups is purposefully ignored for now. Personally, I think popup scaling isn't necessary but if it is required I can implement it (also it would require doing more invasive things to the code and I want to keep this as simple as possible.)

Before the fix: (with a modified version of the "Pan Zoom" web demo)

2024-06-25.19-01-30.mp4

After:

2024-06-25.19-43-06.mp4

The frame delay seems to be unavoidable unless we can move the popups after the layer transform is set (or apply the transforms to the popup during painting). I think this would be better implemented once the menu/popup/tooltip unification is done (#4669).

@emilk emilk added egui bug Something is broken labels Jun 26, 2024
@emilk emilk merged commit d30f79d into emilk:master Jun 26, 2024
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
)

The menu buttons, combo box menus, and tooltips don't take layer
transforms into account when placing their popups, resulting in popups
being placed in the wrong location.

This PR makes the popups take layer transforms into account,
transforming the positions before displaying them on screen. I
implemented this fix for menu buttons, combo boxes, and tooltips; let me
know if there's anything I missed.
Scaling of the popups is purposefully ignored for now. Personally, I
think popup scaling isn't necessary but if it is required I can
implement it (also it would require doing more invasive things to the
code and I want to keep this as simple as possible.)

Before the fix: (with a modified version of the "Pan Zoom" web demo)
<video
src=https://github.com/emilk/egui/assets/104604363/a2d79757-c410-4815-8159-b64d6bd668ee>

After:
<video
src=https://github.com/emilk/egui/assets/104604363/48f8b1d1-d30f-44bf-961f-f10b85964a92>

The frame delay seems to be unavoidable unless we can move the popups
_after_ the layer transform is set (or apply the transforms to the popup
during painting). I think this would be better implemented once the
menu/popup/tooltip unification is done (emilk#4669).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants