Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some Memory methods public #5046

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,16 +750,20 @@ impl Memory {
self.areas().order().iter().copied()
}

pub(crate) fn had_focus_last_frame(&self, id: Id) -> bool {
/// Check if the layer had focus last frame.
/// returns `true` if the layer had focus last frame, but not this one.
pub fn had_focus_last_frame(&self, id: Id) -> bool {
self.focus().and_then(|f| f.id_previous_frame) == Some(id)
}

/// True if the given widget had keyboard focus last frame, but not this one.
/// Check if the layer lost focus last frame
/// returns `true` if the layer lost focus last frame, but not this one.
pub(crate) fn lost_focus(&self, id: Id) -> bool {
self.had_focus_last_frame(id) && !self.has_focus(id)
}

/// True if the given widget has keyboard focus this frame, but didn't last frame.
/// Check if the layer gained focus this frame
/// returns `true` if the layer gained focus this frame, but not last one.
pub(crate) fn gained_focus(&self, id: Id) -> bool {
!self.had_focus_last_frame(id) && self.has_focus(id)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/epaint/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Shadow {
/// Move the shadow by this much.
///
/// For instance, a value of `[1.0, 2.0]` will move the shadow 1 point to the right and 2 points down,
/// causing a drop-shadow effet.
/// causing a drop-shadow effect.
pub offset: Vec2,

/// The width of the blur, i.e. the width of the fuzzy penumbra.
Expand Down
Loading