widgets_ontop: return InnerResponse<R>
This commit is contained in:
parent
7c6109161b
commit
24526d138d
@ -1,12 +1,14 @@
|
|||||||
|
use egui::InnerResponse;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
|
/// Creates an area ontop of a widget with an y offset
|
||||||
pub fn widgets_ontop<R>(
|
pub fn widgets_ontop<R>(
|
||||||
ui: &egui::Ui, id: impl Hash, re: &egui::Response, y_offset: f32,
|
ui: &egui::Ui, id: impl Hash, re: &egui::Response, y_offset: f32,
|
||||||
add_contents: impl FnOnce(&mut egui::Ui) -> R,
|
add_contents: impl FnOnce(&mut egui::Ui) -> R,
|
||||||
) -> R {
|
) -> InnerResponse<R> {
|
||||||
let area = egui::Area::new(id)
|
let area = egui::Area::new(id)
|
||||||
.fixed_pos(re.rect.min.offset_y(y_offset))
|
.fixed_pos(re.rect.min.offset_y(y_offset))
|
||||||
.order(egui::Order::Foreground);
|
.order(egui::Order::Foreground);
|
||||||
|
|
||||||
area.show(ui.ctx(), |ui| add_contents(ui)).inner
|
area.show(ui.ctx(), |ui| add_contents(ui))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user