Add the math for pane resizing

This commit is contained in:
Mikayla Maki
2023-07-12 22:35:51 -07:00
parent 5385ca411b
commit 26b9be628e
5 changed files with 103 additions and 41 deletions
+13
View File
@@ -1268,6 +1268,19 @@ impl Vector2FExt for Vector2F {
}
}
pub trait RectFExt {
fn length_along(self, axis: Axis) -> f32;
}
impl RectFExt for RectF {
fn length_along(self, axis: Axis) -> f32 {
match axis {
Axis::Horizontal => self.width(),
Axis::Vertical => self.height(),
}
}
}
#[derive(Copy, Clone, Debug)]
pub struct SizeConstraint {
pub min: Vector2F,
+1 -1
View File
@@ -27,7 +27,7 @@ pub mod json;
pub mod keymap_matcher;
pub mod platform;
pub use gpui_macros::{test, Element};
pub use window::{Axis, SizeConstraint, Vector2FExt, WindowContext};
pub use window::{Axis, RectFExt, SizeConstraint, Vector2FExt, WindowContext};
pub use anyhow;
pub use serde_json;