From 1e4e873c9bb58e04d285dcca44976496860e1ab8 Mon Sep 17 00:00:00 2001 From: Lucas Meurer Date: Wed, 17 Jul 2024 19:33:47 +0200 Subject: [PATCH] Add some more documentation --- crates/egui/src/frame_state.rs | 5 +++++ crates/egui/src/response.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/crates/egui/src/frame_state.rs b/crates/egui/src/frame_state.rs index 2a4a6b25028d..f2f3b02bf062 100644 --- a/crates/egui/src/frame_state.rs +++ b/crates/egui/src/frame_state.rs @@ -42,8 +42,13 @@ pub struct PerLayerState { #[derive(Clone, Debug)] pub struct ScrollTarget { + // The range that the scroll area should scroll to. pub range: Rangef, + /// How should we align the rect within the visible area? + /// If `align` is [`Align::TOP`] it means "put the top of the rect at the top of the scroll area", etc. + /// If `align` is `None`, it'll scroll enough to bring the UI into view. pub align: Option, + /// How should the scroll be animated? pub animation: style::ScrollAnimation, } diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 146fbc64342d..e07752586741 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -848,6 +848,7 @@ impl Response { self.scroll_to_me_animation(align, self.ctx.style().scroll_animation); } + /// Like [`Self::scroll_to_me`], but allows you to specify the [`crate::style::ScrollAnimation`]. pub fn scroll_to_me_animation( &self, align: Option,