Skip to main content

overlay_button_top

Function overlay_button_top 

Source
pub(crate) fn overlay_button_top(ctx: &Context, above: &str, id: &str) -> f32
Expand description

The vertical offset a corner button’s anchor is drawn at, given the area above it in the same corner.

above and the button share the top row when the window is wide enough for both to sit side by side. When it is not — the frame-rate readout is centred, so on a portrait phone it reaches into the corner the fullscreen button anchors to — the button drops to the row under above instead: hiding the end of the reading under the button that is meant to sit beside it on a roomier window does not help. The fallback keeps both legible and separated at any width.

Both areas are anchored, and an anchored area is laid out against the rectangle the previous pass remembered for it — which is what is compared here, so the decision is made about the very positions egui will use.