1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Now show_tooltip_area_dyn and was_tooltip_open_last_frame was reverted to be like before!

This commit is contained in:
Konkitoman
2023-08-11 18:30:45 +03:00
parent 74e50044b5
commit 622814d8ed

View File

@@ -257,19 +257,6 @@ 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
let parent_window_pos = (0, 0);
// TODO: Need some how to calculate the ui size before rendering!
ctx.create_viewport_sync(
ViewportBuilder::default()
.with_position(Some((
window_pos.x as i32 + parent_window_pos.0,
window_pos.y as i32 + parent_window_pos.1,
)))
.with_decorations(false)
.with_title(format!("Popup Window: {area_id:?}")),
|ctx| {
ctx.viewport_command(ctx.get_viewport_id(), ViewportCommand::CursorHitTest(false));
Area::new(area_id) Area::new(area_id)
.order(Order::Tooltip) .order(Order::Tooltip)
.fixed_pos(window_pos) .fixed_pos(window_pos)
@@ -284,8 +271,6 @@ fn show_tooltip_area_dyn<'c, R>(
}) })
.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(
ViewportBuilder::empty().with_title(format!("Popup Window: {area_id:?}")),
|ctx| {
let layer_id = LayerId::new(Order::Tooltip, area_id); let layer_id = LayerId::new(Order::Tooltip, area_id);
ctx.memory(|mem| mem.areas.visible_last_frame(&layer_id)) if ctx.memory(|mem| mem.areas.visible_last_frame(&layer_id)) {
},
);
if res {
return true; return true;
} }
} }