pub struct Options {Show 17 fields
pub dark_style: Arc<Style>,
pub light_style: Arc<Style>,
pub theme_preference: ThemePreference,
pub fallback_theme: Theme,
pub(crate) system_theme: Option<Theme>,
pub zoom_factor: f32,
pub zoom_with_keyboard: bool,
pub tessellation_options: TessellationOptions,
pub repaint_on_widget_change: bool,
pub max_passes: NonZero<usize>,
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 input_options: InputOptions,
pub reduce_texture_memory: bool,
}
Expand description
Some global options that you can read and write.
See also crate::style::DebugOptions
.
Fields§
§dark_style: Arc<Style>
The default style for new Ui
:s in dark mode.
light_style: Arc<Style>
The default style for new Ui
:s in light mode.
theme_preference: ThemePreference
Preference for selection between dark and light crate::Context::style
as the active style used by all subsequent windows, panels, etc.
Default: ThemePreference::System
.
fallback_theme: Theme
Which theme to use in case Self::theme_preference
is ThemePreference::System
and egui fails to detect the system theme.
Default: crate::Theme::Dark
.
system_theme: Option<Theme>
§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. Increase it to make all UI elements larger.
You should 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, as it may lead to endless repaints for an unknown reason. See (https://github.com/rerun-io/rerun/issues/5018).
max_passes: NonZero<usize>
Maximum number of passes to run in one frame.
Set to 1
for pure single-pass immediate mode.
Set to something larger than 1
to allow multi-pass when needed.
Default is 2
. This means sometimes a frame will cost twice as much,
but usually only rarely (e.g. when showing a new panel for the first time).
egui will usually only ever run one pass, even if max_passes
is large.
If this is 1
, crate::Context::request_discard
will be ignored.
Multi-pass is supported by crate::Context::run
.
See crate::Context::request_discard
for more.
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 are an experimental feature of egui, and not supported on all platforms.
eframe
only supports it on web.
Consider using AccessKit instead,
which is supported by eframe
.
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
, or have a lot of text styles.
warn_on_id_clash: bool
Check reusing of Id
s, 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::Line
s.
scroll_zoom_speed: f32
Controls the speed at which we zoom in when doing ctrl/cmd + scroll.
input_options: InputOptions
Options related to input state handling.
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§
Trait Implementations§
§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Options, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Options, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Options
impl Serialize for Options
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl Freeze for Options
impl !RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl !UnwindSafe for Options
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request