mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Now all sizes are in Vec2 insted of Pos2
This commit is contained in:
@@ -126,10 +126,10 @@ pub fn window_builder<E>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(min_size) = *min_window_size {
|
if let Some(min_size) = *min_window_size {
|
||||||
window_builder = window_builder.with_min_inner_size(Some(min_size.to_pos2()));
|
window_builder = window_builder.with_min_inner_size(Some(min_size));
|
||||||
}
|
}
|
||||||
if let Some(max_size) = *max_window_size {
|
if let Some(max_size) = *max_window_size {
|
||||||
window_builder = window_builder.with_max_inner_size(Some(max_size.to_pos2()));
|
window_builder = window_builder.with_max_inner_size(Some(max_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
window_builder = window_builder.with_drag_and_drop(*drag_and_drop_support);
|
window_builder = window_builder.with_drag_and_drop(*drag_and_drop_support);
|
||||||
@@ -153,7 +153,7 @@ pub fn window_builder<E>(
|
|||||||
if let Some(initial_window_size) = *initial_window_size {
|
if let Some(initial_window_size) = *initial_window_size {
|
||||||
let initial_window_size =
|
let initial_window_size =
|
||||||
initial_window_size.at_most(largest_monitor_point_size(event_loop));
|
initial_window_size.at_most(largest_monitor_point_size(event_loop));
|
||||||
window_builder = window_builder.with_inner_size(Some(initial_window_size.to_pos2()));
|
window_builder = window_builder.with_inner_size(Some(initial_window_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
*initial_window_size
|
*initial_window_size
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl WindowSettings {
|
|||||||
|
|
||||||
if let Some(inner_size_points) = self.inner_size_points {
|
if let Some(inner_size_points) = self.inner_size_points {
|
||||||
window
|
window
|
||||||
.with_inner_size(Some(inner_size_points.to_pos2()))
|
.with_inner_size(Some(inner_size_points))
|
||||||
.with_fullscreen(self.fullscreen)
|
.with_fullscreen(self.fullscreen)
|
||||||
} else {
|
} else {
|
||||||
window
|
window
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{fmt::Display, sync::Arc};
|
use std::{fmt::Display, sync::Arc};
|
||||||
|
|
||||||
use epaint::Pos2;
|
use epaint::{Pos2, Vec2};
|
||||||
|
|
||||||
use crate::{Context, Id};
|
use crate::{Context, Id};
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ pub struct ViewportBuilder {
|
|||||||
pub title: String,
|
pub title: String,
|
||||||
pub name: Option<(String, String)>,
|
pub name: Option<(String, String)>,
|
||||||
pub position: Option<Option<Pos2>>,
|
pub position: Option<Option<Pos2>>,
|
||||||
pub inner_size: Option<Option<Pos2>>,
|
pub inner_size: Option<Option<Vec2>>,
|
||||||
pub fullscreen: Option<bool>,
|
pub fullscreen: Option<bool>,
|
||||||
pub maximized: Option<bool>,
|
pub maximized: Option<bool>,
|
||||||
pub minimized: Option<bool>,
|
pub minimized: Option<bool>,
|
||||||
@@ -77,8 +77,8 @@ pub struct ViewportBuilder {
|
|||||||
pub title_hidden: Option<bool>,
|
pub title_hidden: Option<bool>,
|
||||||
pub titlebar_transparent: Option<bool>,
|
pub titlebar_transparent: Option<bool>,
|
||||||
pub fullsize_content_view: Option<bool>,
|
pub fullsize_content_view: Option<bool>,
|
||||||
pub min_inner_size: Option<Option<Pos2>>,
|
pub min_inner_size: Option<Option<Vec2>>,
|
||||||
pub max_inner_size: Option<Option<Pos2>>,
|
pub max_inner_size: Option<Option<Vec2>>,
|
||||||
pub drag_and_drop: Option<bool>,
|
pub drag_and_drop: Option<bool>,
|
||||||
|
|
||||||
pub close_button: Option<bool>,
|
pub close_button: Option<bool>,
|
||||||
@@ -95,7 +95,7 @@ impl ViewportBuilder {
|
|||||||
title: "Dummy egui viewport".into(),
|
title: "Dummy egui viewport".into(),
|
||||||
name: None,
|
name: None,
|
||||||
position: None,
|
position: None,
|
||||||
inner_size: Some(Some(Pos2::new(300.0, 200.0))),
|
inner_size: Some(Some(Vec2::new(300.0, 200.0))),
|
||||||
fullscreen: None,
|
fullscreen: None,
|
||||||
maximized: None,
|
maximized: None,
|
||||||
resizable: Some(true),
|
resizable: Some(true),
|
||||||
@@ -216,19 +216,19 @@ impl ViewportBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
pub fn with_inner_size(mut self, value: Option<Pos2>) -> Self {
|
pub fn with_inner_size(mut self, value: Option<Vec2>) -> Self {
|
||||||
self.inner_size = Some(value);
|
self.inner_size = Some(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
pub fn with_min_inner_size(mut self, value: Option<Pos2>) -> Self {
|
pub fn with_min_inner_size(mut self, value: Option<Vec2>) -> Self {
|
||||||
self.min_inner_size = Some(value);
|
self.min_inner_size = Some(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
pub fn with_max_inner_size(mut self, value: Option<Pos2>) -> Self {
|
pub fn with_max_inner_size(mut self, value: Option<Vec2>) -> Self {
|
||||||
self.max_inner_size = Some(value);
|
self.max_inner_size = Some(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@@ -283,14 +283,14 @@ pub enum ViewportCommand {
|
|||||||
OuterPosition(Pos2),
|
OuterPosition(Pos2),
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
InnerSize(Pos2),
|
InnerSize(Vec2),
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
MinInnerSize(Option<Pos2>),
|
MinInnerSize(Option<Vec2>),
|
||||||
|
|
||||||
/// Should be bigger then 0
|
/// Should be bigger then 0
|
||||||
MaxInnerSize(Option<Pos2>),
|
MaxInnerSize(Option<Vec2>),
|
||||||
ResizeIncrements(Option<Pos2>),
|
ResizeIncrements(Option<Vec2>),
|
||||||
|
|
||||||
/// Top, Bottom, Right, Left
|
/// Top, Bottom, Right, Left
|
||||||
Resize(bool, bool, bool, bool),
|
Resize(bool, bool, bool, bool),
|
||||||
|
|||||||
Reference in New Issue
Block a user