fix Rect.Intersect
This commit is contained in:
parent
da52aa25ec
commit
e64d97efb1
|
@ -272,10 +272,10 @@ func (r Rect) Union(s Rect) Rect {
|
|||
// If r and s don't overlap, this function returns R(0, 0, 0, 0).
|
||||
func (r Rect) Intersect(s Rect) Rect {
|
||||
t := R(
|
||||
math.Min(r.Max.X, s.Max.X),
|
||||
math.Min(r.Max.Y, s.Max.Y),
|
||||
math.Max(r.Min.X, s.Min.X),
|
||||
math.Max(r.Min.Y, s.Min.Y),
|
||||
math.Min(r.Max.X, s.Max.X),
|
||||
math.Min(r.Max.Y, s.Max.Y),
|
||||
)
|
||||
if t.Min.X >= t.Max.X || t.Min.Y >= t.Max.Y {
|
||||
return Rect{}
|
||||
|
|
Loading…
Reference in New Issue