f32: [API] unexport Rectangle

There are no public API that uses f32.Rectangle anymore. Move Rectangle
to an internal package for internal use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-26 10:56:13 +02:00
parent fc79ec5c94
commit b5f12c5f26
15 changed files with 54 additions and 258 deletions
+6 -12
View File
@@ -7,6 +7,7 @@ import (
"io"
"gioui.org/f32"
f32internal "gioui.org/internal/f32"
"gioui.org/internal/ops"
"gioui.org/io/event"
"gioui.org/io/key"
@@ -189,13 +190,6 @@ func (c *pointerCollector) pushArea(kind areaKind, bounds image.Rectangle) {
})
}
// fpt converts a point to a f32.Point.
func fpt(p image.Point) f32.Point {
return f32.Point{
X: float32(p.X), Y: float32(p.Y),
}
}
func (c *pointerCollector) popArea() {
n := len(c.nodeStack)
c.state.nodePlusOne = c.nodeStack[n-1] + 1
@@ -911,8 +905,8 @@ func firstMimeMatch(src, tgt *pointerHandler) (first string, matched bool) {
}
func (op *areaOp) Hit(pos f32.Point) bool {
pos = pos.Sub(fpt(op.rect.Min))
size := fpt(op.rect.Size())
pos = pos.Sub(f32internal.FPt(op.rect.Min))
size := f32internal.FPt(op.rect.Size())
switch op.kind {
case areaRect:
return 0 <= pos.X && pos.X < size.X &&
@@ -931,9 +925,9 @@ func (op *areaOp) Hit(pos f32.Point) bool {
}
func (a *areaNode) bounds() image.Rectangle {
return f32.Rectangle{
Min: a.trans.Transform(fpt(a.area.rect.Min)),
Max: a.trans.Transform(fpt(a.area.rect.Max)),
return f32internal.Rectangle{
Min: a.trans.Transform(f32internal.FPt(a.area.rect.Min)),
Max: a.trans.Transform(f32internal.FPt(a.area.rect.Max)),
}.Round()
}
+2 -1
View File
@@ -19,6 +19,7 @@ import (
"time"
"gioui.org/f32"
f32internal "gioui.org/internal/f32"
"gioui.org/internal/ops"
"gioui.org/io/clipboard"
"gioui.org/io/event"
@@ -242,7 +243,7 @@ func (q *Router) ScrollFocus(dist image.Point) {
q.pointer.queue.Deliver(area, pointer.Event{
Type: pointer.Scroll,
Source: pointer.Touch,
Scroll: fpt(dist),
Scroll: f32internal.FPt(dist),
}, &q.handlers)
}