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
I recently ran into an issue when implementing context menus #543 . The context menu is an Area rendered in a Foreground layer, and it can generally be placed anywhere on the screen, even on top of panels.
The problem was that egui treats all Areas as Windows and all windows are constrained to an available_rect, which is the screen space minus the panels (except for the CentralPanel, which effectively takes up the available_rect). This caused the context menu to not recognize hovers or clicks on anything except the central panel, because it had been constrained to the available_rect:
In this part of the code the position of the context menu Area was constrained out of the panel that had been clicked on, so that the rect used to detect hovers was off-placed.
To circumvent this I turned this code off for immovable Areas, but in general it should be possible to drag windows over panels if that is desired. This seems to be what the drag bounds are for already, but they seem to default to the available_rect. Maybe this should be changed to default to the whole screen area, and there should be a shortcut for the bounds of the background rect.
The text was updated successfully, but these errors were encountered:
mankinskin
changed the title
Define available_rect per Window
Define available_rect per Area
Jul 7, 2021
I recently ran into an issue when implementing context menus #543 . The context menu is an Area rendered in a Foreground layer, and it can generally be placed anywhere on the screen, even on top of panels.
The problem was that egui treats all Areas as Windows and all windows are constrained to an available_rect, which is the screen space minus the panels (except for the CentralPanel, which effectively takes up the available_rect). This caused the context menu to not recognize hovers or clicks on anything except the central panel, because it had been constrained to the available_rect:
egui/egui/src/containers/area.rs
Lines 335 to 339 in 7c5a2d6
In this part of the code the position of the context menu Area was constrained out of the panel that had been clicked on, so that the rect used to detect hovers was off-placed.
To circumvent this I turned this code off for immovable Areas, but in general it should be possible to drag windows over panels if that is desired. This seems to be what the drag bounds are for already, but they seem to default to the available_rect. Maybe this should be changed to default to the whole screen area, and there should be a shortcut for the bounds of the background rect.
The text was updated successfully, but these errors were encountered: