2022-10-31 11:58:26 +00:00
|
|
|
use egui::{Context, Modifiers, ScrollArea, Ui};
|
2021-02-20 08:18:23 +00:00
|
|
|
use std::collections::BTreeSet;
|
2020-10-19 21:06:11 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
use super::About;
|
|
|
|
use super::Demo;
|
|
|
|
use super::View;
|
|
|
|
use crate::is_mobile;
|
|
|
|
|
2020-10-19 21:06:11 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2021-09-29 06:45:13 +00:00
|
|
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
|
|
#[cfg_attr(feature = "serde", serde(default))]
|
2020-11-02 16:53:28 +00:00
|
|
|
struct Demos {
|
2021-09-29 06:45:13 +00:00
|
|
|
#[cfg_attr(feature = "serde", serde(skip))]
|
2021-05-09 08:53:35 +00:00
|
|
|
demos: Vec<Box<dyn Demo>>,
|
2021-02-20 08:18:23 +00:00
|
|
|
|
|
|
|
open: BTreeSet<String>,
|
2020-11-02 16:53:28 +00:00
|
|
|
}
|
2021-05-09 08:53:35 +00:00
|
|
|
|
2020-11-02 16:53:28 +00:00
|
|
|
impl Default for Demos {
|
|
|
|
fn default() -> Self {
|
2021-05-09 08:53:35 +00:00
|
|
|
Self::from_demos(vec![
|
2022-02-19 19:28:25 +00:00
|
|
|
Box::new(super::paint_bezier::PaintBezier::default()),
|
New text layout (#682)
This PR introduces a completely rewritten text layout engine which is simpler and more powerful. It allows mixing different text styles (heading, body, etc) and formats (color, underlining, strikethrough, …) in the same layout pass, and baked into the same `Galley`.
This opens up the door to having a syntax-highlighed code editor, or a WYSIWYG markdown editor.
One major change is the color is now baked in at layout time. However, many widgets changes text color on hovered. But we need to do the text layout before we know if it is hovered. Therefor the painter has an option to override the text color of a galley.
## Performance
Text layout alone is about 20% slower, but a lot of that is because more tessellation is done upfront. Text tessellation is now a lot faster, but text layout + tessellation still lands at a net loss of 5-10% in performance. There are however a few tricks to speed it up (like using `smallvec`) which I am saving for later. Text layout is also cached, meaning that in most cases (when all text isn't changing each frame) text tessellation is actually more important (and that's more than 2x faster!).
Sadly, the actual text cache lookup is significantly slower (300ns -> 600ns). That's because the `TextLayoutJob` is a lot bigger (it has more options, like underlining, fonts etc), so it is slower to hash and compare. I have an idea how to speed this up, but I need to do some other work before I can implement that.
All in all, the performance impact on `demo_with_tesselate__realistic` is about 5-6% in the red. Not great; not terrible. The benefits are worth it, but I also think with some work I can get that down significantly, hopefully down to the old levels.
2021-09-03 16:18:00 +00:00
|
|
|
Box::new(super::code_editor::CodeEditor::default()),
|
2021-10-20 10:34:27 +00:00
|
|
|
Box::new(super::code_example::CodeExample::default()),
|
2021-10-26 17:55:42 +00:00
|
|
|
Box::new(super::context_menu::ContextMenus::default()),
|
2021-01-25 19:43:41 +00:00
|
|
|
Box::new(super::dancing_strings::DancingStrings::default()),
|
|
|
|
Box::new(super::drag_and_drop::DragAndDropDemo::default()),
|
2021-01-27 19:14:53 +00:00
|
|
|
Box::new(super::font_book::FontBook::default()),
|
2021-05-09 08:53:35 +00:00
|
|
|
Box::new(super::MiscDemoWindow::default()),
|
2021-05-09 08:09:05 +00:00
|
|
|
Box::new(super::multi_touch::MultiTouch::default()),
|
2021-01-27 19:14:53 +00:00
|
|
|
Box::new(super::painting::Painting::default()),
|
2021-02-14 20:39:04 +00:00
|
|
|
Box::new(super::plot_demo::PlotDemo::default()),
|
2021-01-25 19:43:41 +00:00
|
|
|
Box::new(super::scrolling::Scrolling::default()),
|
2021-01-27 19:14:53 +00:00
|
|
|
Box::new(super::sliders::Sliders::default()),
|
2022-03-31 19:13:25 +00:00
|
|
|
Box::new(super::strip_demo::StripDemo::default()),
|
|
|
|
Box::new(super::table_demo::TableDemo::default()),
|
2022-01-06 10:32:00 +00:00
|
|
|
Box::new(super::text_edit::TextEdit::default()),
|
2021-01-27 19:14:53 +00:00
|
|
|
Box::new(super::widget_gallery::WidgetGallery::default()),
|
|
|
|
Box::new(super::window_options::WindowOptions::default()),
|
2021-02-07 13:46:53 +00:00
|
|
|
Box::new(super::tests::WindowResizeTest::default()),
|
2021-08-16 19:32:44 +00:00
|
|
|
Box::new(super::window_with_panels::WindowWithPanels::default()),
|
2021-05-09 08:53:35 +00:00
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Demos {
|
|
|
|
pub fn from_demos(demos: Vec<Box<dyn Demo>>) -> Self {
|
|
|
|
let mut open = BTreeSet::new();
|
|
|
|
open.insert(
|
|
|
|
super::widget_gallery::WidgetGallery::default()
|
|
|
|
.name()
|
|
|
|
.to_owned(),
|
|
|
|
);
|
|
|
|
|
|
|
|
Self { demos, open }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn checkboxes(&mut self, ui: &mut Ui) {
|
|
|
|
let Self { demos, open } = self;
|
|
|
|
for demo in demos {
|
|
|
|
let mut is_open = open.contains(demo.name());
|
2022-05-02 11:13:35 +00:00
|
|
|
ui.toggle_value(&mut is_open, demo.name());
|
2021-05-09 08:53:35 +00:00
|
|
|
set_open(open, demo.name(), is_open);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 22:13:10 +00:00
|
|
|
pub fn windows(&mut self, ctx: &Context) {
|
2021-05-09 08:53:35 +00:00
|
|
|
let Self { demos, open } = self;
|
|
|
|
for demo in demos {
|
|
|
|
let mut is_open = open.contains(demo.name());
|
|
|
|
demo.show(ctx, &mut is_open);
|
|
|
|
set_open(open, demo.name(), is_open);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2021-09-29 06:45:13 +00:00
|
|
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
|
|
#[cfg_attr(feature = "serde", serde(default))]
|
2021-05-09 08:53:35 +00:00
|
|
|
struct Tests {
|
2021-09-29 06:45:13 +00:00
|
|
|
#[cfg_attr(feature = "serde", serde(skip))]
|
2021-05-09 08:53:35 +00:00
|
|
|
demos: Vec<Box<dyn Demo>>,
|
|
|
|
|
|
|
|
open: BTreeSet<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Tests {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::from_demos(vec![
|
2021-03-13 11:38:03 +00:00
|
|
|
Box::new(super::tests::CursorTest::default()),
|
2021-01-27 19:14:53 +00:00
|
|
|
Box::new(super::tests::IdTest::default()),
|
2021-02-06 15:54:38 +00:00
|
|
|
Box::new(super::tests::InputTest::default()),
|
2021-02-07 12:48:55 +00:00
|
|
|
Box::new(super::layout_test::LayoutTest::default()),
|
|
|
|
Box::new(super::tests::ManualLayoutTest::default()),
|
|
|
|
Box::new(super::tests::TableTest::default()),
|
2021-05-09 08:53:35 +00:00
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
2021-02-20 08:18:23 +00:00
|
|
|
|
2021-05-09 08:53:35 +00:00
|
|
|
impl Tests {
|
|
|
|
pub fn from_demos(demos: Vec<Box<dyn Demo>>) -> Self {
|
2021-02-20 08:18:23 +00:00
|
|
|
let mut open = BTreeSet::new();
|
|
|
|
open.insert(
|
|
|
|
super::widget_gallery::WidgetGallery::default()
|
|
|
|
.name()
|
|
|
|
.to_owned(),
|
|
|
|
);
|
|
|
|
|
2021-05-06 18:49:22 +00:00
|
|
|
Self { demos, open }
|
2020-11-02 16:53:28 +00:00
|
|
|
}
|
2021-05-09 08:53:35 +00:00
|
|
|
|
2020-11-02 16:53:28 +00:00
|
|
|
pub fn checkboxes(&mut self, ui: &mut Ui) {
|
2021-05-06 18:49:22 +00:00
|
|
|
let Self { demos, open } = self;
|
2021-02-20 08:18:23 +00:00
|
|
|
for demo in demos {
|
|
|
|
let mut is_open = open.contains(demo.name());
|
2022-05-02 11:13:35 +00:00
|
|
|
ui.toggle_value(&mut is_open, demo.name());
|
2021-02-20 08:18:23 +00:00
|
|
|
set_open(open, demo.name(), is_open);
|
2020-11-02 16:53:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 22:13:10 +00:00
|
|
|
pub fn windows(&mut self, ctx: &Context) {
|
2021-05-06 18:49:22 +00:00
|
|
|
let Self { demos, open } = self;
|
2021-02-20 08:18:23 +00:00
|
|
|
for demo in demos {
|
|
|
|
let mut is_open = open.contains(demo.name());
|
|
|
|
demo.show(ctx, &mut is_open);
|
|
|
|
set_open(open, demo.name(), is_open);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-09 08:53:35 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2021-02-20 08:18:23 +00:00
|
|
|
fn set_open(open: &mut BTreeSet<String>, key: &'static str, is_open: bool) {
|
|
|
|
if is_open {
|
|
|
|
if !open.contains(key) {
|
|
|
|
open.insert(key.to_owned());
|
2020-11-02 16:53:28 +00:00
|
|
|
}
|
2021-02-20 08:18:23 +00:00
|
|
|
} else {
|
|
|
|
open.remove(key);
|
2020-11-02 16:53:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2020-10-19 21:06:11 +00:00
|
|
|
/// A menu bar in which you can select different demo windows to show.
|
2021-09-29 06:45:13 +00:00
|
|
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
|
|
#[cfg_attr(feature = "serde", serde(default))]
|
2020-10-19 21:06:11 +00:00
|
|
|
pub struct DemoWindows {
|
2022-05-02 11:13:35 +00:00
|
|
|
about_is_open: bool,
|
|
|
|
about: About,
|
2020-11-02 16:53:28 +00:00
|
|
|
demos: Demos,
|
2021-05-09 08:53:35 +00:00
|
|
|
tests: Tests,
|
2020-10-19 21:06:11 +00:00
|
|
|
}
|
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
impl Default for DemoWindows {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
about_is_open: true,
|
|
|
|
about: Default::default(),
|
|
|
|
demos: Default::default(),
|
|
|
|
tests: Default::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 21:06:11 +00:00
|
|
|
impl DemoWindows {
|
|
|
|
/// Show the app ui (menu bar and windows).
|
2022-01-10 22:13:10 +00:00
|
|
|
pub fn ui(&mut self, ctx: &Context) {
|
2022-05-02 11:13:35 +00:00
|
|
|
if is_mobile(ctx) {
|
|
|
|
self.mobile_ui(ctx);
|
|
|
|
} else {
|
|
|
|
self.desktop_ui(ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mobile_ui(&mut self, ctx: &Context) {
|
|
|
|
if self.about_is_open {
|
|
|
|
let screen_size = ctx.input().screen_rect.size();
|
|
|
|
let default_width = (screen_size.x - 20.0).min(400.0);
|
|
|
|
|
|
|
|
let mut close = false;
|
|
|
|
egui::Window::new(self.about.name())
|
|
|
|
.anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0])
|
|
|
|
.default_width(default_width)
|
|
|
|
.default_height(ctx.available_rect().height() - 46.0)
|
|
|
|
.vscroll(true)
|
|
|
|
.open(&mut self.about_is_open)
|
|
|
|
.resizable(false)
|
|
|
|
.collapsible(false)
|
|
|
|
.show(ctx, |ui| {
|
|
|
|
self.about.ui(ui);
|
|
|
|
ui.add_space(12.0);
|
|
|
|
ui.vertical_centered_justified(|ui| {
|
|
|
|
if ui
|
Fix text sizes being too small (#2069)
Closes https://github.com/emilk/egui/issues/2068
Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!
The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.
If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.
This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
2022-09-21 19:31:08 +00:00
|
|
|
.button(egui::RichText::new("Continue to the demo!").size(20.0))
|
2022-05-02 11:13:35 +00:00
|
|
|
.clicked()
|
|
|
|
{
|
|
|
|
close = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
self.about_is_open &= !close;
|
|
|
|
} else {
|
|
|
|
self.mobile_top_bar(ctx);
|
|
|
|
self.show_windows(ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mobile_top_bar(&mut self, ctx: &Context) {
|
|
|
|
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
|
|
|
egui::menu::bar(ui, |ui| {
|
Fix text sizes being too small (#2069)
Closes https://github.com/emilk/egui/issues/2068
Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!
The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.
If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.
This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
2022-09-21 19:31:08 +00:00
|
|
|
let font_size = 16.5;
|
2022-05-02 11:13:35 +00:00
|
|
|
|
|
|
|
ui.menu_button(egui::RichText::new("⏷ demos").size(font_size), |ui| {
|
|
|
|
ui.set_style(ui.ctx().style()); // ignore the "menu" style set by `menu_button`.
|
|
|
|
self.demo_list_ui(ui);
|
|
|
|
if ui.ui_contains_pointer() && ui.input().pointer.any_click() {
|
|
|
|
ui.close_menu();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-07-22 09:02:26 +00:00
|
|
|
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
2022-05-02 11:13:35 +00:00
|
|
|
use egui::special_emojis::{GITHUB, TWITTER};
|
|
|
|
ui.hyperlink_to(
|
|
|
|
egui::RichText::new(TWITTER).size(font_size),
|
|
|
|
"https://twitter.com/ernerfeldt",
|
|
|
|
);
|
|
|
|
ui.hyperlink_to(
|
|
|
|
egui::RichText::new(GITHUB).size(font_size),
|
|
|
|
"https://github.com/emilk/egui",
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2021-05-09 08:53:35 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
fn desktop_ui(&mut self, ctx: &Context) {
|
2021-05-26 20:06:10 +00:00
|
|
|
egui::SidePanel::right("egui_demo_panel")
|
2022-05-02 11:13:35 +00:00
|
|
|
.resizable(false)
|
2022-10-31 11:58:26 +00:00
|
|
|
.default_width(150.0)
|
2021-05-26 20:06:10 +00:00
|
|
|
.show(ctx, |ui| {
|
2021-05-27 17:30:08 +00:00
|
|
|
egui::trace!(ui);
|
2021-05-09 08:53:35 +00:00
|
|
|
ui.vertical_centered(|ui| {
|
2021-05-26 20:06:10 +00:00
|
|
|
ui.heading("✒ egui demos");
|
2021-05-09 08:53:35 +00:00
|
|
|
});
|
2021-03-31 21:12:42 +00:00
|
|
|
|
2020-12-16 20:57:13 +00:00
|
|
|
ui.separator();
|
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
use egui::special_emojis::{GITHUB, TWITTER};
|
|
|
|
ui.hyperlink_to(
|
|
|
|
format!("{} egui on GitHub", GITHUB),
|
|
|
|
"https://github.com/emilk/egui",
|
|
|
|
);
|
|
|
|
ui.hyperlink_to(
|
|
|
|
format!("{} @ernerfeldt", TWITTER),
|
|
|
|
"https://twitter.com/ernerfeldt",
|
|
|
|
);
|
2021-05-26 20:06:10 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
ui.separator();
|
2021-05-26 20:06:10 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
self.demo_list_ui(ui);
|
2020-12-16 20:57:13 +00:00
|
|
|
});
|
2020-10-21 20:10:55 +00:00
|
|
|
|
2021-05-26 20:06:10 +00:00
|
|
|
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
2022-05-02 11:13:35 +00:00
|
|
|
egui::menu::bar(ui, |ui| {
|
|
|
|
file_menu_button(ui);
|
|
|
|
});
|
2020-10-21 16:05:36 +00:00
|
|
|
});
|
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
self.show_windows(ctx);
|
2020-10-19 21:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Show the open windows.
|
2022-05-02 11:13:35 +00:00
|
|
|
fn show_windows(&mut self, ctx: &Context) {
|
|
|
|
self.about.show(ctx, &mut self.about_is_open);
|
|
|
|
self.demos.windows(ctx);
|
|
|
|
self.tests.windows(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn demo_list_ui(&mut self, ui: &mut egui::Ui) {
|
|
|
|
ScrollArea::vertical().show(ui, |ui| {
|
|
|
|
ui.with_layout(egui::Layout::top_down_justified(egui::Align::LEFT), |ui| {
|
|
|
|
ui.toggle_value(&mut self.about_is_open, self.about.name());
|
|
|
|
|
|
|
|
ui.separator();
|
|
|
|
self.demos.checkboxes(ui);
|
|
|
|
ui.separator();
|
|
|
|
self.tests.checkboxes(ui);
|
|
|
|
ui.separator();
|
2020-10-19 21:06:11 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
if ui.button("Organize windows").clicked() {
|
|
|
|
ui.ctx().memory().reset_areas();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2020-10-19 21:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
fn file_menu_button(ui: &mut Ui) {
|
2022-10-31 11:58:26 +00:00
|
|
|
let organize_shortcut =
|
2022-12-05 16:57:11 +00:00
|
|
|
egui::KeyboardShortcut::new(Modifiers::CTRL | Modifiers::SHIFT, egui::Key::O);
|
2022-10-31 11:58:26 +00:00
|
|
|
let reset_shortcut =
|
2022-12-05 16:57:11 +00:00
|
|
|
egui::KeyboardShortcut::new(Modifiers::CTRL | Modifiers::SHIFT, egui::Key::R);
|
2022-10-31 11:58:26 +00:00
|
|
|
|
|
|
|
// NOTE: we must check the shortcuts OUTSIDE of the actual "File" menu,
|
|
|
|
// or else they would only be checked if the "File" menu was actually open!
|
|
|
|
|
|
|
|
if ui.input_mut().consume_shortcut(&organize_shortcut) {
|
|
|
|
ui.ctx().memory().reset_areas();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ui.input_mut().consume_shortcut(&reset_shortcut) {
|
|
|
|
*ui.ctx().memory() = Default::default();
|
|
|
|
}
|
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
ui.menu_button("File", |ui| {
|
2022-10-31 11:58:26 +00:00
|
|
|
ui.set_min_width(220.0);
|
|
|
|
ui.style_mut().wrap = Some(false);
|
|
|
|
|
2022-11-05 10:18:13 +00:00
|
|
|
// On the web the browser controls the zoom
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
|
|
{
|
|
|
|
egui::gui_zoom::zoom_menu_buttons(ui, None);
|
|
|
|
ui.separator();
|
|
|
|
}
|
|
|
|
|
2022-10-31 11:58:26 +00:00
|
|
|
if ui
|
|
|
|
.add(
|
|
|
|
egui::Button::new("Organize Windows")
|
|
|
|
.shortcut_text(ui.ctx().format_shortcut(&organize_shortcut)),
|
|
|
|
)
|
|
|
|
.clicked()
|
|
|
|
{
|
2022-05-02 11:13:35 +00:00
|
|
|
ui.ctx().memory().reset_areas();
|
|
|
|
ui.close_menu();
|
|
|
|
}
|
2022-10-31 11:58:26 +00:00
|
|
|
|
2022-05-02 11:13:35 +00:00
|
|
|
if ui
|
2022-10-31 11:58:26 +00:00
|
|
|
.add(
|
|
|
|
egui::Button::new("Reset egui memory")
|
|
|
|
.shortcut_text(ui.ctx().format_shortcut(&reset_shortcut)),
|
|
|
|
)
|
2022-05-02 11:13:35 +00:00
|
|
|
.on_hover_text("Forget scroll, positions, sizes etc")
|
|
|
|
.clicked()
|
|
|
|
{
|
|
|
|
*ui.ctx().memory() = Default::default();
|
|
|
|
ui.close_menu();
|
|
|
|
}
|
2020-10-19 21:06:11 +00:00
|
|
|
});
|
|
|
|
}
|