mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Improve docs for ViewportCommand
This commit is contained in:
@@ -994,7 +994,12 @@ pub fn process_viewport_commands(
|
|||||||
let height = size.y.max(1.0);
|
let height = size.y.max(1.0);
|
||||||
window.set_inner_size(LogicalSize::new(width, height));
|
window.set_inner_size(LogicalSize::new(width, height));
|
||||||
}
|
}
|
||||||
egui::ViewportCommand::Resize(top, bottom, right, left) => {
|
egui::ViewportCommand::BeginResize {
|
||||||
|
top,
|
||||||
|
bottom,
|
||||||
|
right,
|
||||||
|
left,
|
||||||
|
} => {
|
||||||
// TODO posibile return the error to `egui::Context`
|
// TODO posibile return the error to `egui::Context`
|
||||||
let _ = window.drag_resize_window(match (top, bottom, right, left) {
|
let _ = window.drag_resize_window(match (top, bottom, right, left) {
|
||||||
(true, false, false, false) => ResizeDirection::North,
|
(true, false, false, false) => ResizeDirection::North,
|
||||||
|
|||||||
@@ -569,7 +569,9 @@ impl ViewportBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// You can send a `ViewportCommand` to the viewport with `Context::viewport_command`
|
/// You can send a [`ViewportCommand`] to the viewport with [`Context::viewport_command`].
|
||||||
|
///
|
||||||
|
/// All coordinates are in logical points.
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
pub enum ViewportCommand {
|
pub enum ViewportCommand {
|
||||||
@@ -578,7 +580,7 @@ pub enum ViewportCommand {
|
|||||||
Visible(bool),
|
Visible(bool),
|
||||||
Drag,
|
Drag,
|
||||||
|
|
||||||
/// Will probably not work as expected!
|
/// Set the outer position of the viewport, i.e. moves the window.
|
||||||
OuterPosition(Pos2),
|
OuterPosition(Pos2),
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
@@ -593,8 +595,17 @@ pub enum ViewportCommand {
|
|||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
ResizeIncrements(Option<Vec2>),
|
ResizeIncrements(Option<Vec2>),
|
||||||
|
|
||||||
/// Top, Bottom, Right, Left
|
/// Begin resizing the viewport with the left mouse button until the button is released.
|
||||||
Resize(bool, bool, bool, bool),
|
///
|
||||||
|
/// There's no guarantee that this will work unless the left mouse button was pressed
|
||||||
|
/// immediately before this function is called.
|
||||||
|
BeginResize {
|
||||||
|
top: bool,
|
||||||
|
bottom: bool,
|
||||||
|
right: bool,
|
||||||
|
left: bool,
|
||||||
|
},
|
||||||
|
|
||||||
Resizable(bool),
|
Resizable(bool),
|
||||||
EnableButtons {
|
EnableButtons {
|
||||||
close: bool,
|
close: bool,
|
||||||
@@ -618,7 +629,7 @@ pub enum ViewportCommand {
|
|||||||
/// 0 = Informational, 1 = Critical
|
/// 0 = Informational, 1 = Critical
|
||||||
RequestUserAttention(Option<u8>),
|
RequestUserAttention(Option<u8>),
|
||||||
|
|
||||||
/// 0 = Light, 1 = Dark
|
/// 0 = Light, 1 = Dark, `None` = system default.
|
||||||
SetTheme(Option<u8>),
|
SetTheme(Option<u8>),
|
||||||
|
|
||||||
ContentProtected(bool),
|
ContentProtected(bool),
|
||||||
|
|||||||
Reference in New Issue
Block a user