1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Fix viewports example

This commit is contained in:
Konkitoman
2023-08-05 15:34:23 +03:00
parent 5ca60cad0e
commit 098d94e705
2 changed files with 29 additions and 11 deletions

View File

@@ -99,6 +99,12 @@ fn main() {
});
}
}
ui.add(
egui::widgets::DragValue::new(&mut value)
.clamp_range(-10..=10)
.speed(0.1),
);
});
});
egui::CollapsingHeader::new("Async Test2").show(ui, |ui| {
@@ -126,10 +132,18 @@ fn main() {
));
if ui.button("Drag").is_pointer_button_down_on() {
ctx.viewport_command(
ctx.get_viewport_id(),
egui::window::ViewportCommand::Drag,
)
if ctx.get_viewport_id() != ctx.get_parent_viewport_id() {
ctx.viewport_command(
ctx.get_viewport_id(),
egui::window::ViewportCommand::Drag,
)
} else {
ctx.memory_mut(|mem| {
mem.set_dragged_id(
egui::Id::new("Test2").with("frame_resize"),
)
});
}
}
});
});
@@ -154,11 +168,15 @@ fn main() {
ctx.get_viewport_id()
));
if ui.button("Drag").is_pointer_button_down_on() {
if ctx.get_viewport_id() != ctx.get_parent_viewport_id() {
ctx.viewport_command(
ctx.get_viewport_id(),
egui::window::ViewportCommand::Drag,
)
} else {
ctx.memory_mut(|mem| {
mem.set_dragged_id(egui::Id::new("Test3").with("frame_resize"))
});
}
});
});