event/size: add an Event.Size method.

This is similar to the Event.Bounds method. Some functions in other
packages take an image.Rectangle (i.e. bounds), others take an
image.Point (i.e size).

Change-Id: Ie892a8902992d4e6b9edfbf6d12342297fae4068
Reviewed-on: https://go-review.googlesource.com/14003
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Nigel Tao 2015-08-28 13:46:38 +10:00
parent 671f57b233
commit b5b6051b23
1 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,12 @@ type Event struct {
Orientation Orientation
}
// Size returns the window's size in pixels, at the time this size event was
// sent.
func (e *Event) Size() image.Point {
return image.Point{e.WidthPx, e.HeightPx}
}
// Bounds returns the window's bounds in pixels, at the time this size event
// was sent.
//