From e5428a3084c6e82d9c58bec449e3815198bfb8d5 Mon Sep 17 00:00:00 2001 From: Kamen Yovchevski <57301959+KYovchevski@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:44:29 +0200 Subject: [PATCH] Add Window::drag-to-scroll (#3118) --- crates/egui/src/containers/window.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 1d2444ca..2e4a9a3e 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -266,6 +266,14 @@ impl<'open> Window<'open> { self } + /// Enable/disable scrolling on the window by dragging with the pointer. `true` by default. + /// + /// See [`ScrollArea::drag_to_scroll`] for more. + pub fn drag_to_scroll(mut self, drag_to_scroll: bool) -> Self { + self.scroll = self.scroll.drag_to_scroll(drag_to_scroll); + self + } + /// Constrain the area up to which the window can be dragged. pub fn drag_bounds(mut self, bounds: Rect) -> Self { self.area = self.area.drag_bounds(bounds);