io/router: use integer coordinates for bounds

There is no need for floating point coordinates, except for transforming
bounds and hit testing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-03-30 12:08:48 +02:00
parent 1f11a5a17b
commit e72c46f13c
5 changed files with 26 additions and 26 deletions
+3 -3
View File
@@ -77,7 +77,7 @@ type SemanticDesc struct {
Selected bool
Disabled bool
Gestures SemanticGestures
Bounds f32.Rectangle
Bounds image.Rectangle
}
// SemanticGestures is a bit-set of supported gestures.
@@ -158,9 +158,9 @@ func (q *Router) ClickFocus() {
return
}
bounds := q.key.queue.BoundsFor(focus)
center := bounds.Max.Add(bounds.Min).Mul(.5)
center := bounds.Max.Add(bounds.Min).Div(2)
e := pointer.Event{
Position: center,
Position: f32.Pt(float32(center.X), float32(center.Y)),
Source: pointer.Touch,
}
e.Type = pointer.Press