diff --git a/CHANGELOG.md b/CHANGELOG.md index b67d8d1f..d9551e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This release has an [MSRV][] of 1.65. - Add `CubicBez::tangents` ([#288] by [@raphlinus]) - Add `Arc::flipped`. ([#367] by [@waywardmonkeys]) - Add `CircleSegment::inner_arc` and `CircleSegment::outer_arc` ([#368] by [@waywardmonkeys]) +- Add `Rect::is_zero_area` and `Size::is_zero_area` and deprecate their `is_empty` methods. ([#370] by [@waywardmonkeys]) ### Changed @@ -59,6 +60,7 @@ Note: A changelog was not kept for or before this release [#361]: https://github.com/linebender/kurbo/pull/361 [#367]: https://github.com/linebender/kurbo/pull/367 [#368]: https://github.com/linebender/kurbo/pull/368 +[#370]: https://github.com/linebender/kurbo/pull/370 [Unreleased]: https://github.com/linebender/kurbo/compare/v0.11.0...HEAD [0.11.0]: https://github.com/linebender/kurbo/releases/tag/v0.11.0 diff --git a/src/rect.rs b/src/rect.rs index dfb78788..bc4ca437 100644 --- a/src/rect.rs +++ b/src/rect.rs @@ -159,12 +159,19 @@ impl Rect { self.width() * self.height() } + /// Whether this rectangle has zero area. + #[inline] + pub fn is_zero_area(&self) -> bool { + self.area() == 0.0 + } + /// Whether this rectangle has zero area. /// /// Note: a rectangle with negative area is not considered empty. #[inline] + #[deprecated(since = "0.11.1", note = "use is_zero_area instead")] pub fn is_empty(&self) -> bool { - self.area() == 0.0 + self.is_zero_area() } /// The center point of the rectangle. diff --git a/src/size.rs b/src/size.rs index d41436c1..4eb97f64 100644 --- a/src/size.rs +++ b/src/size.rs @@ -65,12 +65,19 @@ impl Size { self.width * self.height } + /// Whether this size has zero area. + #[inline] + pub fn is_zero_area(self) -> bool { + self.area() == 0.0 + } + /// Whether this size has zero area. /// /// Note: a size with negative area is not considered empty. #[inline] + #[deprecated(since = "0.11.1", note = "use is_zero_area instead")] pub fn is_empty(self) -> bool { - self.area() == 0.0 + self.is_zero_area() } /// Returns a new size bounded by `min` and `max.`