diff --git a/src/schematic.rs b/src/schematic.rs index 7ff49dd..3c21784 100644 --- a/src/schematic.rs +++ b/src/schematic.rs @@ -744,13 +744,12 @@ impl<'a> egui::Widget for SchematicWidget<'a> { textnum: i, }); } - response.context_menu(|ui| { + let r = response.context_menu(|ui| { if ui.button("Properties").clicked() { ui.close_menu(); } }); - // TODO check this for correctness - response + r.map(|r|r.response).or(Some(response)).unwrap() } MouseMode::TextDrag => { if response.clicked() { @@ -768,13 +767,12 @@ impl<'a> egui::Widget for SchematicWidget<'a> { }; actions.push(a); } - response.context_menu(|ui| { + let r = response.context_menu(|ui| { if ui.button("Properties").clicked() { ui.close_menu(); } }); - // TODO check this for correctness - response + r.map(|r|r.response).or(Some(response)).unwrap() } }; pr = pr.union(response); @@ -864,7 +862,7 @@ impl<'a> egui::Widget for SchematicWidget<'a> { self.sch.schematic_log.apply(&mut self.sch.schematic, a); } - let pr = pr.context_menu(|ui| { + let ipr = pr.context_menu(|ui| { if ui.button("Do a thing").clicked() { ui.close_menu(); } @@ -881,8 +879,7 @@ impl<'a> egui::Widget for SchematicWidget<'a> { focusable: true, }, ); - //pr.union(response) - //TODO fix this - response + + pr } } diff --git a/src/symbol.rs b/src/symbol.rs index d4c6ccd..10815dc 100644 --- a/src/symbol.rs +++ b/src/symbol.rs @@ -353,7 +353,6 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { ui.close_menu(); } }); - //TODO check this for correctness response } MouseMode::TextDrag => { @@ -375,7 +374,6 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { ui.close_menu(); } }); - //TODO check this for correctness response } }; @@ -405,7 +403,6 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { ui.close_menu(); } }); - // TODO check this for correctness response } MouseMode::TextDrag => { @@ -414,14 +411,13 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { ui.close_menu(); } }); - //TODO check this for correctness response } }; pr = pr.union(response); } - let pr = pr.context_menu(|ui| { + let ipr = pr.context_menu(|ui| { if ui.button("Do a thing").clicked() { ui.close_menu(); } @@ -429,7 +425,7 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { ui.close_menu(); } }); - if let Some(pr) = pr { + if let Some(pr) = ipr { let pos = ui.input(|i| i.pointer.interact_pos()); if let Some(pos) = pos { let pos2 = pos - zoom_origin.to_vec2(); @@ -483,9 +479,7 @@ impl<'a> egui::Widget for SymbolDefinitionWidget<'a> { } let (_area, response) = ui.allocate_exact_size(size, sense); - //pr.union(response) - //TODO fix this - response + pr.union(response) } }