Skip to content

Commit f5b9562

Browse files
Andrew Wheeler(Genusis)hecrj
andauthored
Bounds Contains update. (#2017)
* changed the way contains works to exclude <= for point.y and point.x on width and height check to avoid multiple selects * update changelog * Update `CHANGELOG` --------- Co-authored-by: Héctor Ramón Jiménez <hector0193@gmail.com>
1 parent 318ee4d commit f5b9562

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8686
- `image::Viewer` reacting to any scroll event. [#1998](https://github.com/iced-rs/iced/pull/1998)
8787
- `TextInput` pasting text when `Alt` key is pressed. [#2006](https://github.com/iced-rs/iced/pull/2006)
8888
- Broken link to old `iced_native` crate in `README`. [#2024](https://github.com/iced-rs/iced/pull/2024)
89+
- `Rectangle::contains` being non-exclusive. [#2017](https://github.com/iced-rs/iced/pull/2017)
8990

9091
Many thanks to...
9192

@@ -98,6 +99,7 @@ Many thanks to...
9899
- @clarkmoody
99100
- @Davidster
100101
- @Drakulix
102+
- @genusistimelord
101103
- @GyulyVGC
102104
- @ids1024
103105
- @jhff

core/src/rectangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl Rectangle<f32> {
7474
/// Returns true if the given [`Point`] is contained in the [`Rectangle`].
7575
pub fn contains(&self, point: Point) -> bool {
7676
self.x <= point.x
77-
&& point.x <= self.x + self.width
77+
&& point.x < self.x + self.width
7878
&& self.y <= point.y
79-
&& point.y <= self.y + self.height
79+
&& point.y < self.y + self.height
8080
}
8181

8282
/// Returns true if the current [`Rectangle`] is completely within the given

0 commit comments

Comments
 (0)