mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
* Fix posibile deadlock when sending a viewport command from a sync viewport
* Improve viewports example
This commit is contained in:
@@ -86,6 +86,17 @@ impl eframe::App for App {
|
||||
if ui.button("Add").clicked() {
|
||||
*state += 1;
|
||||
}
|
||||
|
||||
if ui.button("Set parent pos {0, 0}").clicked() {
|
||||
let ctx = ui.ctx().clone();
|
||||
let parent_id = ctx.get_parent_viewport_id();
|
||||
ctx.viewport_command_for(
|
||||
parent_id,
|
||||
egui::ViewportCommand::OuterPosition(
|
||||
egui::pos2(0.0, 0.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
show_as_popup(
|
||||
@@ -111,6 +122,17 @@ impl eframe::App for App {
|
||||
if ui.button("Add").clicked() {
|
||||
*state += 1;
|
||||
}
|
||||
|
||||
if ui.button("Set parent pos {0, 0}").clicked() {
|
||||
let ctx = ui.ctx().clone();
|
||||
let parent_id = ctx.get_parent_viewport_id();
|
||||
ctx.viewport_command_for(
|
||||
parent_id,
|
||||
egui::ViewportCommand::OuterPosition(
|
||||
egui::pos2(0.0, 0.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
show_as_popup(
|
||||
@@ -160,6 +182,17 @@ impl eframe::App for App {
|
||||
if ui.button("Add").clicked() {
|
||||
*state += 1;
|
||||
}
|
||||
|
||||
if ui.button("Set parent pos {0, 0}").clicked() {
|
||||
let ctx = ui.ctx().clone();
|
||||
let parent_id = ctx.get_parent_viewport_id();
|
||||
ctx.viewport_command_for(
|
||||
parent_id,
|
||||
egui::ViewportCommand::OuterPosition(
|
||||
egui::pos2(0.0, 0.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
show_as_popup(
|
||||
@@ -185,6 +218,17 @@ impl eframe::App for App {
|
||||
if ui.button("Add").clicked() {
|
||||
*state += 1;
|
||||
}
|
||||
|
||||
if ui.button("Set parent pos {0, 0}").clicked() {
|
||||
let ctx = ui.ctx().clone();
|
||||
let parent_id = ctx.get_parent_viewport_id();
|
||||
ctx.viewport_command_for(
|
||||
parent_id,
|
||||
egui::ViewportCommand::OuterPosition(
|
||||
egui::pos2(0.0, 0.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
show_as_popup(
|
||||
|
||||
Reference in New Issue
Block a user