Skip to content
Open
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
12 changes: 8 additions & 4 deletions egui-nav/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,24 @@ impl<'a, Route: Clone> Nav<'a, Route> {
),
);

let layer_id = if transitioning {
let (layer_id, fg_id) = if transitioning {
// when transitioning, we need a new layer id otherwise the
// view transform will transform more things than we want
LayerId::new(Order::Foreground, ui.id().with("fg"))
// We also need a distinct widget ID to match the layer change
(
LayerId::new(Order::Foreground, ui.id().with("fg")),
ui.id().with("fg"),
)
} else {
// if we don't use the same layer id as the ui, then we
// will have scrollview MouseWheel scroll issues due to
// the way rect_contains_pointer works with overlapping
// layers
ui.layer_id()
(ui.layer_id(), ui.id())
};
render_fg(
ui,
ui.id(), // this must be ui.id() to not break scroll positions
fg_id,
layer_id,
Some(Vec2::new(state.offset, 0.0)),
clip,
Expand Down