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

Misc code cleanup, docs fixes, etc

This commit is contained in:
Emil Ernerfeldt
2022-02-19 20:51:51 +01:00
parent e49245fae5
commit 89d19860b8
15 changed files with 67 additions and 41 deletions

View File

@@ -2,7 +2,7 @@
name = "egui"
version = "0.16.1"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
description = "Simple, portable immediate mode GUI library for Rust"
description = "An easy-to-use immediate mode GUI that runs on both web and native"
edition = "2021"
rust-version = "1.56"
homepage = "https://github.com/emilk/egui"

View File

@@ -9,6 +9,8 @@
//! The order in which you add panels matter!
//! The first panel you add will always be the outermost, and the last you add will always be the innermost.
//!
//! You must never open one top-level panel from within another panel. Add one panel, then the next.
//!
//! Always add any [`CentralPanel`] last.
//!
//! Add your [`Window`]:s after any top-level panels.

View File

@@ -165,18 +165,27 @@ pub enum Event {
///
/// When the user presses enter/return, do not send a `Text` (just [`Key::Enter`]).
Text(String),
/// A key was pressed or released.
Key {
key: Key,
/// Was it pressed or released?
pressed: bool,
/// The state of the modifier keys at the time of the event.
modifiers: Modifiers,
},
/// The mouse or touch moved to a new place.
PointerMoved(Pos2),
/// A mouse button was pressed or released (or a touch started or stopped).
PointerButton {
/// Where is the pointer?
pos: Pos2,
/// What mouse button? For touches, use [`PointerButton::Primary`].
button: PointerButton,
/// Was it the button/touch pressed this frame, or released?
pressed: bool,
/// The state of the modifier keys at the time of the event
/// The state of the modifier keys at the time of the event.
modifiers: Modifiers,
},
/// The mouse left the screen, or the last/primary touch input disappeared.
@@ -217,6 +226,7 @@ pub enum Event {
/// Unique identifier of a finger/pen. Value is stable from touch down
/// to lift-up
id: TouchId,
/// One of: start move end cancel.
phase: TouchPhase,
/// Position of the touch (or where the touch was last detected)
pos: Pos2,

View File

@@ -146,7 +146,7 @@ impl Widget for &mut epaint::TessellationOptions {
epsilon: _,
} = self;
ui.checkbox(anti_alias, "Antialias")
.on_hover_text("Turn off for small performance gain.");
.on_hover_text("Apply feathering to smooth out the edges of shapes. Turn off for small performance gain.");
ui.add(
crate::widgets::Slider::new(bezier_tolerance, 0.0001..=10.0)
.logarithmic(true)

View File

@@ -23,6 +23,7 @@ pub enum Order {
/// Debug layer, always painted last / on top
Debug,
}
impl Order {
const COUNT: usize = 6;
const ALL: [Order; Self::COUNT] = [

View File

@@ -447,7 +447,7 @@ impl Response {
///
/// If `align` is `None`, it'll scroll enough to bring the UI into view.
///
/// See also: [`Ui::scroll_to_cursor`], [`Ui::scroll_to`].
/// See also: [`Ui::scroll_to_cursor`], [`Ui::scroll_to_rect`].
///
/// ```
/// # egui::__run_test_ui(|ui| {

View File

@@ -908,7 +908,7 @@ impl Ui {
///
/// If `align` is `None`, it'll scroll enough to bring the cursor into view.
///
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to`].
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to_rect`].
///
/// ```
/// # use egui::Align;
@@ -933,7 +933,7 @@ impl Ui {
///
/// If `align` is not provided, it'll scroll enough to bring the cursor into view.
///
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to`].
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to_rect`].
///
/// ```
/// # use egui::Align;
@@ -1014,7 +1014,7 @@ impl Ui {
.inner
}
/// Add a single[`Widget`] that is possibly disabled, i.e. greyed out and non-interactive.
/// Add a single [`Widget`] that is possibly disabled, i.e. greyed out and non-interactive.
///
/// If you call `add_enabled` from within an already disabled `Ui`,
/// the widget will always be disabled, even if the `enabled` argument is true.
@@ -1069,7 +1069,7 @@ impl Ui {
})
}
/// Add a single[`Widget`] that is possibly invisible.
/// Add a single [`Widget`] that is possibly invisible.
///
/// An invisible widget still takes up the same space as if it were visible.
///

View File

@@ -613,6 +613,7 @@ impl PlotItem for Polygon {
}
/// Text inside the plot.
#[derive(Clone)]
pub struct Text {
pub(super) text: WidgetText,
pub(super) position: Value,
@@ -1079,6 +1080,7 @@ impl PlotItem for Arrows {
}
/// An image in the plot.
#[derive(Clone)]
pub struct PlotImage {
pub(super) position: Value,
pub(super) texture_id: TextureId,