SourceClass Scene
from egui import Sceneclass Scene:A container that allows you to zoom and pan.
This is similar to egui.ScrollArea but:
* Supports zooming
* Has no scroll bars
* Has no limits on the scrolling
Methods§
Sourcedef drag_pan_buttons(self, /, drag_pan_buttons: DragPanButtons) -> Scene§
Specify which pointer buttons can be used to pan by clicking and dragging.
By default, this is DragPanButtons.all().
Sourcedef max_inner_size(self, /, max_inner_size: Vec2) -> Scene§
Set the maximum size of the inner Ui that will be created.
Sourcedef sense(self, /, sense: Sense) -> Scene§
Specify what type of input the scene should respond to.
The default is Sense.click_and_drag().
Set this to Sense.hover() to disable panning via clicking and dragging.
Sourcedef show(self, /, scene_rect: Rect) -> Any§
scene_rect contains the view bounds of the inner Ui.
scene_rect will be mutated by any panning/zooming done by the user.
If scene_rect is somehow invalid (e.g. Rect.ZERO),
then it will be reset to the inner rect of the inner ui.
You need to store the scene_rect in your state between frames.
Sourcedef zoom_range(self, /, min: float, max: float) -> Scene§
Set the allowed zoom range.
The default zoom range is 0.0..=1.0,
which mean you zan make things arbitrarily small, but you cannot zoom in past a 1:1 ratio.
If you want to allow zooming in, you can set the zoom range to 0.0..=float.INFINITY.
Note that text rendering becomes blurry when you zoom in: https://github.com/emilk/egui/issues/4813.