Small tweaks to documentation and demo
This commit is contained in:
parent
d0a47bf8e8
commit
84399cde83
4 changed files with 13 additions and 7 deletions
|
@ -437,13 +437,12 @@ impl Response {
|
|||
/// Move the scroll to this UI with the specified alignment.
|
||||
///
|
||||
/// ```
|
||||
/// # use egui::Align;
|
||||
/// # egui::__run_test_ui(|ui| {
|
||||
/// egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
/// for i in 0..1000 {
|
||||
/// let response = ui.button(format!("Button {}", i));
|
||||
/// let response = ui.button("Scroll to me");
|
||||
/// if response.clicked() {
|
||||
/// response.scroll_to_me(Align::Center);
|
||||
/// response.scroll_to_me(egui::Align::Center);
|
||||
/// }
|
||||
/// }
|
||||
/// });
|
||||
|
@ -490,6 +489,8 @@ impl Response {
|
|||
/// });
|
||||
/// # });
|
||||
/// ```
|
||||
///
|
||||
/// See also: [`Ui::menu_button`] and [`Ui::close_menu`].
|
||||
pub fn context_menu(self, add_contents: impl FnOnce(&mut Ui)) -> Self {
|
||||
self.ctx
|
||||
.context_menu_system()
|
||||
|
|
|
@ -1763,7 +1763,9 @@ impl Ui {
|
|||
result
|
||||
}
|
||||
|
||||
/// Close menu (with submenus), if any.
|
||||
/// Close the menu we are in (including submenus), if any.
|
||||
///
|
||||
/// See also: [`Self::menu_button`] and [`Response::context_menu`].
|
||||
pub fn close_menu(&mut self) {
|
||||
if let Some(menu_state) = &mut self.menu_state {
|
||||
menu_state.write().close();
|
||||
|
@ -1780,7 +1782,9 @@ impl Ui {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
/// Create a menu button. Creates a button for a sub-menu when the `Ui` is inside a menu.
|
||||
/// Create a menu button that when clicked will show the given menu.
|
||||
///
|
||||
/// If called from within a menu this will instead create a button for a sub-menu.
|
||||
///
|
||||
/// ```
|
||||
/// # egui::__run_test_ui(|ui| {
|
||||
|
@ -1793,6 +1797,8 @@ impl Ui {
|
|||
/// });
|
||||
/// # });
|
||||
/// ```
|
||||
///
|
||||
/// See also: [`Self::close_menu`] and [`Response::context_menu`].
|
||||
pub fn menu_button<R>(
|
||||
&mut self,
|
||||
title: impl Into<WidgetText>,
|
||||
|
|
|
@ -153,7 +153,7 @@ impl DemoWindows {
|
|||
|
||||
egui::SidePanel::right("egui_demo_panel")
|
||||
.min_width(150.0)
|
||||
.default_width(190.0)
|
||||
.default_width(180.0)
|
||||
.show(ctx, |ui| {
|
||||
egui::trace!(ui);
|
||||
ui.vertical_centered(|ui| {
|
||||
|
|
|
@ -153,7 +153,6 @@ impl BackendPanel {
|
|||
ui.label(
|
||||
"Everything you see is rendered as textured triangles. There is no DOM and no HTML elements. \
|
||||
This is the web page, reinvented with game tech.");
|
||||
ui.label("This is also work in progress, and not ready for production… yet :)");
|
||||
ui.hyperlink("https://github.com/emilk/egui");
|
||||
|
||||
ui.separator();
|
||||
|
|
Loading…
Reference in a new issue