gpui: Update argument name of the from_corners method (#29968)

Release Notes:

- N/A
This commit is contained in:
Jason Lee 2025-05-06 12:17:39 +08:00 committed by GitHub
parent c5d8407df4
commit 3d737fd268
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -804,7 +804,7 @@ where
///
/// # Arguments
///
/// * `upper_left` - A `Point<T>` representing the top left corner of the rectangle.
/// * `top_left` - A `Point<T>` representing the top left corner of the rectangle.
/// * `bottom_right` - A `Point<T>` representing the bottom right corner of the rectangle.
///
/// # Returns
@ -815,22 +815,22 @@ where
///
/// ```
/// # use gpui::{Bounds, Point};
/// let upper_left = Point { x: 0, y: 0 };
/// let top_left = Point { x: 0, y: 0 };
/// let bottom_right = Point { x: 10, y: 10 };
/// let bounds = Bounds::from_corners(upper_left, bottom_right);
/// let bounds = Bounds::from_corners(top_left, bottom_right);
///
/// assert_eq!(bounds.origin, upper_left);
/// assert_eq!(bounds.origin, top_left);
/// assert_eq!(bounds.size.width, 10);
/// assert_eq!(bounds.size.height, 10);
/// ```
pub fn from_corners(upper_left: Point<T>, bottom_right: Point<T>) -> Self {
pub fn from_corners(top_left: Point<T>, bottom_right: Point<T>) -> Self {
let origin = Point {
x: upper_left.x.clone(),
y: upper_left.y.clone(),
x: top_left.x.clone(),
y: top_left.y.clone(),
};
let size = Size {
width: bottom_right.x - upper_left.x,
height: bottom_right.y - upper_left.y,
width: bottom_right.x - top_left.x,
height: bottom_right.y - top_left.y,
};
Bounds { origin, size }
}