From 46e39d3dd95c086802f06d1d6f6616da9bba2dc1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 21 Oct 2020 22:20:30 +0200 Subject: [PATCH] Add high-prio TODO to refactor layer system --- TODO.md | 3 +-- egui/src/context.rs | 12 +++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/TODO.md b/TODO.md index 557d5828..b5226ce6 100644 --- a/TODO.md +++ b/TODO.md @@ -5,8 +5,7 @@ TODO-list for the Egui project. If you looking for something to do, look here. ## Top priority * Text input: text selection etc -* Fix `is_mouse_over_area()` for menu bar: - * Probably a good time to create some sort of `ctx.top_panel()` allocation system and refactor paint layers +* Refactor graphics layers and areas so one don't have to register LayerId:s. ## Other diff --git a/egui/src/context.rs b/egui/src/context.rs index a120ed0b..51fd12f9 100644 --- a/egui/src/context.rs +++ b/egui/src/context.rs @@ -267,12 +267,10 @@ impl Context { /// A `Ui` for the entire screen, behind any windows. fn fullscreen_ui(self: &Arc) -> Ui { let rect = self.input.screen_rect(); - let id = Id::background(); - let layer_id = LayerId { - order: Order::Background, - id, - }; - // Ensure we register the background area so it is painted: + let layer_id = LayerId::background(); + // Ensure we register the background area so it is painted + // and so we handle interactions properly (clicks on it etc). + // TODO: we shouldn't need to register areas. Maybe GraphicLayers should take care of it? self.memory().areas.set_state( layer_id, containers::area::State { @@ -282,7 +280,7 @@ impl Context { vel: Default::default(), }, ); - Ui::new(self.clone(), layer_id, id, rect, rect) + Ui::new(self.clone(), layer_id, layer_id.id, rect, rect) } // ---------------------------------------------------------------------