2024-01-16 01:08:21 +03:00
|
|
|
package gg
|
|
|
|
|
|
|
|
// The type describes a simple
|
|
|
|
// rectangle without transformations.
|
|
|
|
type Size struct {
|
|
|
|
// The upper left corner position point.
|
|
|
|
Position Point
|
|
|
|
// Absolute width and height.
|
2024-01-22 10:23:47 +03:00
|
|
|
// Both must be positive values.
|
2024-01-16 01:08:21 +03:00
|
|
|
Width, Height Float
|
|
|
|
}
|
|
|
|
|
2024-01-22 10:23:47 +03:00
|
|
|
func (size Size) ContainsPoint(pt Point) bool {
|
|
|
|
return (size.Position.X < pt.X && (size.Position.X + size.Width) > pt.X ) &&
|
|
|
|
(size.Position.Y < pt.Y && (size.Position.Y + size.Height) > pt.Y )
|
|
|
|
}
|
|
|
|
|
2024-01-16 01:08:21 +03:00
|
|
|
//type (s Size) ContainsPoint
|