1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 21:00:03 -04:00
Files
egui/crates
Lucas Meurer 693c009fdf Add Context::run_hosted_viewport for app-rendered viewports
Adds a way to run a pass for a viewport that the application paints itself,
e.g. into a texture. This is the building block for embedding one egui UI
inside another: a scaled, rotated or blurred sub-UI, a minimap, a live
preview, or an off-screen capture.

The nested-pass machinery already existed for immediate viewports, but two
things were missing for an application to use it:

* Nothing public sets `ViewportState::used`, so `end_pass` threw the child
  viewport's state away every pass. Hover, click and drag could never work.
* The child appeared in `FullOutput::viewport_output`, so an integration
  like eframe would open a native window for it.

`ViewportClass::Hosted` marks these viewports and keeps them out of
`viewport_output`, so the integration never learns they exist. In return the
application takes on what a backend normally does: supply the `RawInput`,
paint the shapes, apply the texture delta, and act on the platform output.

Also derives `Debug` for `ViewportClass`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 20:53:08 +02:00
..
2026-07-20 11:07:29 +02:00