mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
f32: added Point.In(Rectangle)
Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
@@ -66,6 +66,12 @@ func (p Point) Mul(s float32) Point {
|
||||
return Point{X: p.X * s, Y: p.Y * s}
|
||||
}
|
||||
|
||||
// In reports whether p is in r.
|
||||
func (p Point) In(r Rectangle) bool {
|
||||
return r.Min.X <= p.X && p.X < r.Max.X &&
|
||||
r.Min.Y <= p.Y && p.Y < r.Max.Y
|
||||
}
|
||||
|
||||
// Size returns r's width and height.
|
||||
func (r Rectangle) Size() Point {
|
||||
return Point{X: r.Dx(), Y: r.Dy()}
|
||||
|
||||
Reference in New Issue
Block a user