Skip to content

Commit

Permalink
Update memory.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 29, 2024
1 parent 11904eb commit 197bbd1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ pub struct Options {
/// Controls the tessellator.
pub tessellation_options: epaint::TessellationOptions,

/// If `true`, This will call `egui::Context::request_repaint()` at the end of each frame
/// If `false` (default), egui is only updated if are input events (like mouse movements) or there are some animations in the GUI.
pub continuous_mode: bool,

/// If any widget moves or changes id, repaint everything.
///
/// It is recommended you keep this OFF, because
Expand Down Expand Up @@ -265,6 +269,7 @@ impl Default for Options {
zoom_factor: 1.0,
zoom_with_keyboard: true,
tessellation_options: Default::default(),
continuous_mode: false,
repaint_on_widget_change: false,
screen_reader: false,
preload_font_glyphs: true,
Expand All @@ -286,6 +291,7 @@ impl Options {
zoom_factor: _, // TODO(emilk)
zoom_with_keyboard,
tessellation_options,
continuous_mode,
repaint_on_widget_change,
screen_reader: _, // needs to come from the integration
preload_font_glyphs: _,
Expand All @@ -301,6 +307,8 @@ impl Options {
CollapsingHeader::new("⚙ Options")
.default_open(false)
.show(ui, |ui| {
ui.checkbox(continuous_mode, "Repaint at the end of each frame");

ui.checkbox(
repaint_on_widget_change,
"Repaint if any widget moves or changes id",
Expand Down Expand Up @@ -337,16 +345,16 @@ impl Options {
.show(ui, |ui| {
ui.horizontal(|ui| {
ui.label("Line scroll speed");
ui.add(crate::DragValue::new(line_scroll_speed).range(0.0..=f32::INFINITY))
.on_hover_text(
"How many lines to scroll with each tick of the mouse wheel",
);
ui.add(
crate::DragValue::new(line_scroll_speed).clamp_range(0.0..=f32::INFINITY),
)
.on_hover_text("How many lines to scroll with each tick of the mouse wheel");
});
ui.horizontal(|ui| {
ui.label("Scroll zoom speed");
ui.add(
crate::DragValue::new(scroll_zoom_speed)
.range(0.0..=f32::INFINITY)
.clamp_range(0.0..=f32::INFINITY)
.speed(0.001),
)
.on_hover_text("How fast to zoom with ctrl/cmd + scroll");
Expand Down

0 comments on commit 197bbd1

Please sign in to comment.