mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Context menus (#543)
Main usage: `response.context_menu(…)` and `ui.menu_button`
This commit is contained in:
@@ -212,6 +212,7 @@ impl WidgetGallery {
|
||||
|
||||
ui.add(doc_link_label("Plot", "plot"));
|
||||
ui.add(example_plot());
|
||||
|
||||
ui.end_row();
|
||||
|
||||
ui.hyperlink_to(
|
||||
@@ -227,14 +228,14 @@ impl WidgetGallery {
|
||||
}
|
||||
|
||||
fn example_plot() -> egui::plot::Plot {
|
||||
use egui::plot::{Line, Plot, Value, Values};
|
||||
use egui::plot::{Line, Value, Values};
|
||||
let n = 128;
|
||||
let line = Line::new(Values::from_values_iter((0..=n).map(|i| {
|
||||
use std::f64::consts::TAU;
|
||||
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
|
||||
let x = egui::remap(i as f64, 0.0..=n as f64, -TAU..=TAU);
|
||||
Value::new(x, x.sin())
|
||||
})));
|
||||
Plot::new("example_plot")
|
||||
egui::plot::Plot::new("example_plot")
|
||||
.line(line)
|
||||
.height(32.0)
|
||||
.data_aspect(1.0)
|
||||
|
||||
Reference in New Issue
Block a user