Skip to content

Commit

Permalink
Misc cleanup of in gpui geometry.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Dec 17, 2024
1 parent ccf2a60 commit 77e7cc0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions crates/gpui/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::{

use crate::{AppContext, DisplayId};

/// An axis along which a measurement can be made.
/// Axis in a 2D cartesian space.
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum Axis {
/// The y axis, or up and down
Expand Down Expand Up @@ -46,7 +46,7 @@ pub trait Along {
fn apply_along(&self, axis: Axis, f: impl FnOnce(Self::Unit) -> Self::Unit) -> Self;
}

/// Describes a location in a 2D cartesian coordinate space.
/// Describes a location in a 2D cartesian space.
///
/// It holds two public fields, `x` and `y`, which represent the coordinates in the space.
/// The type `T` for the coordinates can be any type that implements `Default`, `Clone`, and `Debug`.
Expand Down Expand Up @@ -533,6 +533,7 @@ where
},
}
}

/// Returns a new `Size` with the minimum width and height from `self` and `other`.
///
/// # Arguments
Expand Down Expand Up @@ -731,13 +732,7 @@ impl Bounds<Pixels> {
.or_else(|| cx.primary_display());

display
.map(|display| {
let center = display.bounds().center();
Bounds {
origin: point(center.x - size.width / 2., center.y - size.height / 2.),
size,
}
})
.map(|display| Bounds::centered_at(display.bounds().center(), size))
.unwrap_or_else(|| Bounds {
origin: point(px(0.), px(0.)),
size,
Expand Down

0 comments on commit 77e7cc0

Please sign in to comment.