mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Fix up some examples (#3614)
This commit is contained in:
@@ -1392,11 +1392,16 @@ impl Context {
|
||||
/// Sets zoom factor of the UI.
|
||||
/// Will become active at the start of the next frame.
|
||||
///
|
||||
/// Note that calling this will not update [`Self::zoom_factor`] until the end of the frame.
|
||||
///
|
||||
/// This is used to calculate the `pixels_per_point`
|
||||
/// for the UI as `pixels_per_point = zoom_fator * native_pixels_per_point`.
|
||||
///
|
||||
/// The default is 1.0.
|
||||
/// Make larger to make everything larger.
|
||||
///
|
||||
/// It is better to call this than modifying
|
||||
/// [`Options::zoom_factor`].
|
||||
#[inline(always)]
|
||||
pub fn set_zoom_factor(&self, zoom_factor: f32) {
|
||||
self.write(|ctx| {
|
||||
|
||||
@@ -156,7 +156,12 @@ impl RawInput {
|
||||
pub enum ViewportEvent {
|
||||
/// The user clicked the close-button on the window, or similar.
|
||||
///
|
||||
/// It is up to the user to react to this by _not_ showing the viewport in the next frame in the parent viewport.
|
||||
/// If this is the root viewport, the application will exit
|
||||
/// after this frame unless you send a
|
||||
/// [`crate::ViewportCommand::CancelClose`] command.
|
||||
///
|
||||
/// If this is not the root viewport,
|
||||
/// it is up to the user to hide this viewport the next frame.
|
||||
///
|
||||
/// This even will wake up both the child and parent viewport.
|
||||
Close,
|
||||
@@ -216,6 +221,14 @@ pub struct ViewportInfo {
|
||||
}
|
||||
|
||||
impl ViewportInfo {
|
||||
/// This viewport has been told to close.
|
||||
///
|
||||
/// If this is the root viewport, the application will exit
|
||||
/// after this frame unless you send a
|
||||
/// [`crate::ViewportCommand::CancelClose`] command.
|
||||
///
|
||||
/// If this is not the root viewport,
|
||||
/// it is up to the user to hide this viewport the next frame.
|
||||
pub fn close_requested(&self) -> bool {
|
||||
self.events
|
||||
.iter()
|
||||
|
||||
@@ -178,6 +178,9 @@ pub struct Options {
|
||||
///
|
||||
/// The default is 1.0.
|
||||
/// Make larger to make everything larger.
|
||||
///
|
||||
/// Please call [`crate::Context::set_zoom_factor`]
|
||||
/// instead of modifying this directly!
|
||||
pub zoom_factor: f32,
|
||||
|
||||
/// If `true`, egui will change the scale of the ui ([`crate::Context::zoom_factor`]) when the user
|
||||
|
||||
@@ -831,6 +831,9 @@ pub enum ViewportCommand {
|
||||
/// For other viewports, the [`crate::ViewportInfo::close_requested`] flag will be set.
|
||||
Close,
|
||||
|
||||
/// Calcel the closing that was signaled by [`crate::ViewportInfo::close_requested`].
|
||||
CancelClose,
|
||||
|
||||
/// Set the window title.
|
||||
Title(String),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user