1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Small improvements to the demo (add source code links etc)

This commit is contained in:
Emil Ernerfeldt
2021-03-07 19:51:07 +01:00
parent 25d4a7e11e
commit d6233de9dc
4 changed files with 40 additions and 20 deletions

View File

@@ -94,6 +94,7 @@ impl super::Demo for ManualLayoutTest {
impl super::View for ManualLayoutTest {
fn ui(&mut self, ui: &mut egui::Ui) {
egui::reset_button(ui, self);
let Self {
widget_offset,
widget_size,
@@ -117,9 +118,12 @@ impl super::View for ManualLayoutTest {
ui.add(egui::Slider::f32(&mut widget_size.y, 0.0..=400.0));
ui.end_row();
});
let widget_rect =
egui::Rect::from_min_size(ui.min_rect().min + *widget_offset, *widget_size);
ui.add(crate::__egui_github_link_file!());
// Showing how to place a widget anywhere in the `Ui`:
match *widget_type {
WidgetType::Button => {
@@ -137,6 +141,7 @@ impl super::View for ManualLayoutTest {
// ----------------------------------------------------------------------------
#[derive(PartialEq)]
pub struct TableTest {
num_cols: usize,
num_rows: usize,
@@ -209,6 +214,11 @@ impl super::View for TableTest {
ui.end_row();
}
});
ui.vertical_centered(|ui| {
egui::reset_button(ui, self);
ui.add(crate::__egui_github_link_file!());
});
}
}
@@ -238,6 +248,10 @@ impl super::Demo for InputTest {
impl super::View for InputTest {
fn ui(&mut self, ui: &mut egui::Ui) {
ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!());
});
let response = ui.add(
egui::Button::new("Click, double-click or drag me with any mouse button")
.sense(egui::Sense::click_and_drag()),