diff --git a/event/config/config.go b/event/config/config.go index b229baf..256844e 100644 --- a/event/config/config.go +++ b/event/config/config.go @@ -9,6 +9,8 @@ package config // import "golang.org/x/mobile/event/config" import ( + "image" + "golang.org/x/mobile/geom" ) @@ -29,3 +31,12 @@ type Event struct { // PixelsPerPt values. In general, work in geom.Pt. PixelsPerPt float32 } + +// Bounds returns the window's bounds in pixels, at the time this configuration +// event was sent. +// +// The top-left pixel is always (0, 0). The bottom-right pixel is given by the +// width and height. +func (e *Event) Bounds() image.Rectangle { + return image.Rectangle{Max: image.Point{e.WidthPx, e.HeightPx}} +}