Add Ui::spinner
shortcut method (#1494)
This commit is contained in:
parent
b738418243
commit
2745699bd6
4 changed files with 14 additions and 3 deletions
|
@ -23,6 +23,7 @@ NOTE: [`egui_web`](../egui_web/CHANGELOG.md), [`egui-winit`](../egui-winit/CHANG
|
||||||
* Fixed potential scale bug when DPI scaling changes (e.g. when dragging a window between different displays) ([#1441](https://github.com/emilk/egui/pull/1441)).
|
* Fixed potential scale bug when DPI scaling changes (e.g. when dragging a window between different displays) ([#1441](https://github.com/emilk/egui/pull/1441)).
|
||||||
* MSRV (Minimum Supported Rust Version) is now `1.60.0` ([#1467](https://github.com/emilk/egui/pull/1467)).
|
* MSRV (Minimum Supported Rust Version) is now `1.60.0` ([#1467](https://github.com/emilk/egui/pull/1467)).
|
||||||
* Added new feature `puffin` to add [`puffin profiler`](https://github.com/EmbarkStudios/puffin) scopes ([#1483](https://github.com/emilk/egui/pull/1483)).
|
* Added new feature `puffin` to add [`puffin profiler`](https://github.com/EmbarkStudios/puffin) scopes ([#1483](https://github.com/emilk/egui/pull/1483)).
|
||||||
|
* Added `Ui::spinner()` shortcut method ([#1494](https://github.com/emilk/egui/pull/1494)).
|
||||||
|
|
||||||
|
|
||||||
## 0.17.0 - 2022-02-22
|
## 0.17.0 - 2022-02-22
|
||||||
|
|
|
@ -1383,12 +1383,22 @@ impl Ui {
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shortcut for `add(Separator::default())` (see [`Separator`]).
|
/// Shortcut for `add(Separator::default())`
|
||||||
|
///
|
||||||
|
/// See also [`Separator`].
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn separator(&mut self) -> Response {
|
pub fn separator(&mut self) -> Response {
|
||||||
Separator::default().ui(self)
|
Separator::default().ui(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shortcut for `add(Spinner::new())`
|
||||||
|
///
|
||||||
|
/// See also [`Spinner`].
|
||||||
|
#[inline]
|
||||||
|
pub fn spinner(&mut self) -> Response {
|
||||||
|
Spinner::new().ui(self)
|
||||||
|
}
|
||||||
|
|
||||||
/// Modify an angle. The given angle should be in radians, but is shown to the user in degrees.
|
/// Modify an angle. The given angle should be in radians, but is shown to the user in degrees.
|
||||||
/// The angle is NOT wrapped, so the user may select, for instance 720° = 2𝞃 = 4π
|
/// The angle is NOT wrapped, so the user may select, for instance 720° = 2𝞃 = 4π
|
||||||
pub fn drag_angle(&mut self, radians: &mut f32) -> Response {
|
pub fn drag_angle(&mut self, radians: &mut f32) -> Response {
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl epi::App for HttpApp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui.add(egui::Spinner::new());
|
ui.spinner();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl eframe::App for MyApp {
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| match promise.ready() {
|
egui::CentralPanel::default().show(ctx, |ui| match promise.ready() {
|
||||||
None => {
|
None => {
|
||||||
ui.add(egui::Spinner::new()); // still loading
|
ui.spinner(); // still loading
|
||||||
}
|
}
|
||||||
Some(Err(err)) => {
|
Some(Err(err)) => {
|
||||||
ui.colored_label(egui::Color32::RED, err); // something went wrong
|
ui.colored_label(egui::Color32::RED, err); // something went wrong
|
||||||
|
|
Loading…
Reference in a new issue