mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Now show_tooltip_area_dyn and was_tooltip_open_last_frame was reverted to be like before!
This commit is contained in:
@@ -257,35 +257,20 @@ fn show_tooltip_area_dyn<'c, R>(
|
|||||||
add_contents: Box<dyn FnOnce(&mut Ui) -> R + 'c>,
|
add_contents: Box<dyn FnOnce(&mut Ui) -> R + 'c>,
|
||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
use containers::*;
|
use containers::*;
|
||||||
// TODO: Get window pos from winit
|
Area::new(area_id)
|
||||||
let parent_window_pos = (0, 0);
|
.order(Order::Tooltip)
|
||||||
// TODO: Need some how to calculate the ui size before rendering!
|
.fixed_pos(window_pos)
|
||||||
ctx.create_viewport_sync(
|
.constrain(true)
|
||||||
ViewportBuilder::default()
|
.interactable(false)
|
||||||
.with_position(Some((
|
.drag_bounds(ctx.screen_rect())
|
||||||
window_pos.x as i32 + parent_window_pos.0,
|
.show(ctx, |ui| {
|
||||||
window_pos.y as i32 + parent_window_pos.1,
|
Frame::popup(&ctx.style())
|
||||||
)))
|
.show(ui, |ui| {
|
||||||
.with_decorations(false)
|
ui.set_max_width(ui.spacing().tooltip_width);
|
||||||
.with_title(format!("Popup Window: {area_id:?}")),
|
add_contents(ui)
|
||||||
|ctx| {
|
|
||||||
ctx.viewport_command(ctx.get_viewport_id(), ViewportCommand::CursorHitTest(false));
|
|
||||||
Area::new(area_id)
|
|
||||||
.order(Order::Tooltip)
|
|
||||||
.fixed_pos(window_pos)
|
|
||||||
.constrain(true)
|
|
||||||
.interactable(false)
|
|
||||||
.drag_bounds(ctx.screen_rect())
|
|
||||||
.show(ctx, |ui| {
|
|
||||||
Frame::popup(&ctx.style())
|
|
||||||
.show(ui, |ui| {
|
|
||||||
ui.set_max_width(ui.spacing().tooltip_width);
|
|
||||||
add_contents(ui)
|
|
||||||
})
|
|
||||||
.inner
|
|
||||||
})
|
})
|
||||||
},
|
.inner
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Was this popup visible last frame?
|
/// Was this popup visible last frame?
|
||||||
@@ -296,14 +281,8 @@ pub fn was_tooltip_open_last_frame(ctx: &Context, tooltip_id: Id) -> bool {
|
|||||||
if *individual_id == tooltip_id {
|
if *individual_id == tooltip_id {
|
||||||
let area_id = common_id.with(count);
|
let area_id = common_id.with(count);
|
||||||
|
|
||||||
let res = ctx.create_viewport_sync(
|
let layer_id = LayerId::new(Order::Tooltip, area_id);
|
||||||
ViewportBuilder::empty().with_title(format!("Popup Window: {area_id:?}")),
|
if ctx.memory(|mem| mem.areas.visible_last_frame(&layer_id)) {
|
||||||
|ctx| {
|
|
||||||
let layer_id = LayerId::new(Order::Tooltip, area_id);
|
|
||||||
ctx.memory(|mem| mem.areas.visible_last_frame(&layer_id))
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if res {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user