Skip to content

Commit

Permalink
Take layer order into account before hit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 16, 2024
1 parent 87a4f5d commit 2521929
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,19 +498,8 @@ impl ContextImpl {
viewport.this_pass.begin_pass(screen_rect);

{
let area_order = self.memory.areas().order_map();

let mut layers: Vec<LayerId> = viewport.prev_pass.widgets.layer_ids().collect();

layers.sort_by(|a, b| {
if a.order == b.order {
// Maybe both are windows, so respect area order:
area_order.get(a).cmp(&area_order.get(b))
} else {
// comparing e.g. background to tooltips
a.order.cmp(&b.order)
}
});
layers.sort_by(|&a, &b| self.memory.areas().compare_order(a, b));

viewport.hits = if let Some(pos) = viewport.input.pointer.interact_pos() {
let interact_radius = self.memory.options.style().interaction.interact_radius;
Expand Down

0 comments on commit 2521929

Please sign in to comment.