From 549b2432284d88cac7493b776e9437ede7f8efbc Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 30 Mar 2024 18:00:43 +0100 Subject: [PATCH] Rename `fn scroll2` to `fn scroll` (#4282) --- crates/egui/src/containers/scroll_area.rs | 10 ++++++++++ crates/egui/src/containers/window.rs | 12 +++++++++++- crates/egui_demo_lib/src/demo/code_example.rs | 2 +- crates/egui_demo_lib/src/demo/tests.rs | 2 +- crates/egui_demo_lib/src/demo/window_options.rs | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index c35cca34225..9c05068f60f 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -337,6 +337,16 @@ impl ScrollArea { } /// Turn on/off scrolling on the horizontal/vertical axes. + /// + /// You can pass in `false`, `true`, `[false, true]` etc. + #[inline] + pub fn scroll(mut self, scroll_enabled: impl Into) -> Self { + self.scroll_enabled = scroll_enabled.into(); + self + } + + /// Turn on/off scrolling on the horizontal/vertical axes. + #[deprecated = "Renamed to `scroll`"] #[inline] pub fn scroll2(mut self, scroll_enabled: impl Into) -> Self { self.scroll_enabled = scroll_enabled.into(); diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 619675ca8a5..2b266dbd8ff 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -328,9 +328,19 @@ impl<'open> Window<'open> { } /// Enable/disable horizontal/vertical scrolling. `false` by default. + /// + /// You can pass in `false`, `true`, `[false, true]` etc. + #[inline] + pub fn scroll(mut self, scroll: impl Into) -> Self { + self.scroll = self.scroll.scroll(scroll); + self + } + + /// Enable/disable horizontal/vertical scrolling. `false` by default. + #[deprecated = "Renamed to `scroll`"] #[inline] pub fn scroll2(mut self, scroll: impl Into) -> Self { - self.scroll = self.scroll.scroll2(scroll); + self.scroll = self.scroll.scroll(scroll); self } diff --git a/crates/egui_demo_lib/src/demo/code_example.rs b/crates/egui_demo_lib/src/demo/code_example.rs index 8e109ca4da0..2b09b557be3 100644 --- a/crates/egui_demo_lib/src/demo/code_example.rs +++ b/crates/egui_demo_lib/src/demo/code_example.rs @@ -115,7 +115,7 @@ impl super::Demo for CodeExample { .open(open) .min_width(375.0) .default_size([390.0, 500.0]) - .scroll2(false) + .scroll(false) .resizable([true, false]) .show(ctx, |ui| self.ui(ui)); } diff --git a/crates/egui_demo_lib/src/demo/tests.rs b/crates/egui_demo_lib/src/demo/tests.rs index a29e37fe0bc..44e355d0e8e 100644 --- a/crates/egui_demo_lib/src/demo/tests.rs +++ b/crates/egui_demo_lib/src/demo/tests.rs @@ -372,7 +372,7 @@ impl super::Demo for InputTest { .default_width(800.0) .open(open) .resizable(true) - .scroll2(false) + .scroll(false) .show(ctx, |ui| { use super::View as _; self.ui(ui); diff --git a/crates/egui_demo_lib/src/demo/window_options.rs b/crates/egui_demo_lib/src/demo/window_options.rs index 54c77988e75..7d4241dd38e 100644 --- a/crates/egui_demo_lib/src/demo/window_options.rs +++ b/crates/egui_demo_lib/src/demo/window_options.rs @@ -67,7 +67,7 @@ impl super::Demo for WindowOptions { .constrain(constrain) .collapsible(collapsible) .title_bar(title_bar) - .scroll2(scroll2) + .scroll(scroll2) .enabled(enabled); if closable { window = window.open(open);