Struct egui::Options

source ·
pub struct Options {
    pub(crate) style: Arc<Style>,
    pub zoom_factor: f32,
    pub zoom_with_keyboard: bool,
    pub tessellation_options: TessellationOptions,
    pub repaint_on_widget_change: bool,
    pub screen_reader: bool,
    pub preload_font_glyphs: bool,
    pub warn_on_id_clash: bool,
    pub line_scroll_speed: f32,
    pub scroll_zoom_speed: f32,
    pub reduce_texture_memory: bool,
}
Expand description

Some global options that you can read and write.

See also crate::style::DebugOptions.

Fields§

§style: Arc<Style>

The default style for new Ui:s.

§zoom_factor: f32

Global zoom factor of the UI.

This is used to calculate the pixels_per_point for the UI as pixels_per_point = zoom_fator * native_pixels_per_point.

The default is 1.0. Make larger to make everything larger.

Please call crate::Context::set_zoom_factor instead of modifying this directly!

§zoom_with_keyboard: bool

If true, egui will change the scale of the ui (crate::Context::zoom_factor) when the user presses Cmd+Plus, Cmd+Minus or Cmd+0, just like in a browser.

This is true by default.

On the web-backend of eframe this is set to false by default, so that the zoom shortcuts are handled exclusively by the browser, which will change the native_pixels_per_point (devicePixelRatio). You can still zoom egui independently by calling crate::Context::set_zoom_factor, which will be applied on top of the browsers global zoom.

§tessellation_options: TessellationOptions

Controls the tessellator.

§repaint_on_widget_change: bool

If any widget moves or changes id, repaint everything.

It is recommended you keep this OFF, because it is know to cause endless repaints, for unknown reasons (https://github.com/rerun-io/rerun/issues/5018).

§screen_reader: bool

This is a signal to any backend that we want the crate::PlatformOutput::events read out loud.

The only change to egui is that labels can be focused by pressing tab.

Screen readers is an experimental feature of egui, and not supported on all platforms.

eframe supports it only on web, but you should consider using AccessKit instead, which eframe supports.

§preload_font_glyphs: bool

If true, the most common glyphs (ASCII) are pre-rendered to the texture atlas.

Only the fonts in Style::text_styles will be pre-cached.

This can lead to fewer texture operations, but may use up the texture atlas quicker if you are changing Style::text_styles, of have a lot of text styles.

§warn_on_id_clash: bool

Check reusing of Ids, and show a visual warning on screen when one is found.

By default this is true in debug builds.

§line_scroll_speed: f32

Multiplier for the scroll speed when reported in crate::MouseWheelUnit::Lines.

§scroll_zoom_speed: f32

Controls the speed at which we zoom in when doing ctrl/cmd + scroll.

§reduce_texture_memory: bool

If true, egui will discard the loaded image data after the texture is loaded onto the GPU to reduce memory usage.

In modern GPU rendering, the texture data is not required after the texture is loaded.

This is beneficial when using a large number or resolution of images and there is no need to retain the image data, potentially saving a significant amount of memory.

The drawback is that it becomes impossible to serialize the loaded images or render in non-GPU systems.

Default is false.

Implementations§

source§

impl Options

source

pub fn ui(&mut self, ui: &mut Ui)

Show the options in the ui.

Trait Implementations§

source§

impl Clone for Options

source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Options

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Options

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq for Options

source§

fn eq(&self, other: &Options) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Options

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,