Skip to content

Commit

Permalink
Reword "frame" -> "pass" in a bunch of places
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Sep 12, 2024
1 parent 40e37cf commit b71a2f1
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 175 deletions.
10 changes: 5 additions & 5 deletions crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ impl SidePanel {
let rect = inner_response.response.rect;

match side {
Side::Left => ctx.frame_state_mut(|state| {
Side::Left => ctx.pass_state_mut(|state| {
state.allocate_left_panel(Rect::from_min_max(available_rect.min, rect.max));
}),
Side::Right => ctx.frame_state_mut(|state| {
Side::Right => ctx.pass_state_mut(|state| {
state.allocate_right_panel(Rect::from_min_max(rect.min, available_rect.max));
}),
}
Expand Down Expand Up @@ -885,12 +885,12 @@ impl TopBottomPanel {

match side {
TopBottomSide::Top => {
ctx.frame_state_mut(|state| {
ctx.pass_state_mut(|state| {
state.allocate_top_panel(Rect::from_min_max(available_rect.min, rect.max));
});
}
TopBottomSide::Bottom => {
ctx.frame_state_mut(|state| {
ctx.pass_state_mut(|state| {
state.allocate_bottom_panel(Rect::from_min_max(rect.min, available_rect.max));
});
}
Expand Down Expand Up @@ -1149,7 +1149,7 @@ impl CentralPanel {
let inner_response = self.show_inside_dyn(&mut panel_ui, add_contents);

// Only inform ctx about what we actually used, so we can shrink the native window to fit.
ctx.frame_state_mut(|state| state.allocate_central_panel(inner_response.response.rect));
ctx.pass_state_mut(|state| state.allocate_central_panel(inner_response.response.rect));

inner_response
}
Expand Down
12 changes: 6 additions & 6 deletions crates/egui/src/containers/popup.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Show popup windows, tooltips, context menus etc.
use frame_state::PerWidgetTooltipState;
use pass_state::PerWidgetTooltipState;

use crate::{
frame_state, vec2, AboveOrBelow, Align, Align2, Area, AreaState, Context, Frame, Id,
pass_state, vec2, AboveOrBelow, Align, Align2, Area, AreaState, Context, Frame, Id,
InnerResponse, Key, LayerId, Layout, Order, Pos2, Rect, Response, Sense, Ui, UiKind, Vec2,
Widget, WidgetText,
};
Expand Down Expand Up @@ -162,7 +162,7 @@ fn show_tooltip_at_dyn<'c, R>(

remember_that_tooltip_was_shown(ctx);

let mut state = ctx.frame_state_mut(|fs| {
let mut state = ctx.pass_state_mut(|fs| {
// Remember that this is the widget showing the tooltip:
fs.layers
.entry(parent_layer)
Expand Down Expand Up @@ -213,14 +213,14 @@ fn show_tooltip_at_dyn<'c, R>(

state.tooltip_count += 1;
state.bounding_rect = state.bounding_rect.union(response.rect);
ctx.frame_state_mut(|fs| fs.tooltips.widget_tooltips.insert(widget_id, state));
ctx.pass_state_mut(|fs| fs.tooltips.widget_tooltips.insert(widget_id, state));

inner
}

/// What is the id of the next tooltip for this widget?
pub fn next_tooltip_id(ctx: &Context, widget_id: Id) -> Id {
let tooltip_count = ctx.frame_state(|fs| {
let tooltip_count = ctx.pass_state(|fs| {
fs.tooltips
.widget_tooltips
.get(&widget_id)
Expand Down Expand Up @@ -409,7 +409,7 @@ pub fn popup_above_or_below_widget<R>(
let frame_margin = frame.total_margin();
let inner_width = widget_response.rect.width() - frame_margin.sum().x;

parent_ui.ctx().frame_state_mut(|fs| {
parent_ui.ctx().pass_state_mut(|fs| {
fs.layers
.entry(parent_ui.layer_id())
.or_default()
Expand Down
10 changes: 5 additions & 5 deletions crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::needless_range_loop)]

use crate::{
emath, epaint, frame_state, lerp, pos2, remap, remap_clamp, vec2, Context, Id, NumExt, Pos2,
emath, epaint, pass_state, lerp, pos2, remap, remap_clamp, vec2, Context, Id, NumExt, Pos2,
Rangef, Rect, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
};

Expand Down Expand Up @@ -819,22 +819,22 @@ impl Prepared {

let scroll_delta = content_ui
.ctx()
.frame_state_mut(|state| std::mem::take(&mut state.scroll_delta));
.pass_state_mut(|state| std::mem::take(&mut state.scroll_delta));

for d in 0..2 {
// FrameState::scroll_delta is inverted from the way we apply the delta, so we need to negate it.
// PassState::scroll_delta is inverted from the way we apply the delta, so we need to negate it.
let mut delta = -scroll_delta.0[d];
let mut animation = scroll_delta.1;

// We always take both scroll targets regardless of which scroll axes are enabled. This
// is to avoid them leaking to other scroll areas.
let scroll_target = content_ui
.ctx()
.frame_state_mut(|state| state.scroll_target[d].take());
.pass_state_mut(|state| state.scroll_target[d].take());

if scroll_enabled[d] {
if let Some(target) = scroll_target {
let frame_state::ScrollTarget {
let pass_state::ScrollTarget {
range,
align,
animation: animation_update,
Expand Down
Loading

0 comments on commit b71a2f1

Please sign in to comment.