mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
gesture,widget,f32: [API] use integer coordinates for gesture coordinates
Most widget code operate in integer coordinates. This change makes gesture pointer coordinates integer, to lessen the number of float32 to int conversions. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-2
@@ -6,7 +6,6 @@ import (
|
||||
"image"
|
||||
"time"
|
||||
|
||||
"gioui.org/f32"
|
||||
"gioui.org/gesture"
|
||||
"gioui.org/io/key"
|
||||
"gioui.org/io/pointer"
|
||||
@@ -39,7 +38,7 @@ type Click struct {
|
||||
// Press represents a past pointer press.
|
||||
type Press struct {
|
||||
// Position of the press.
|
||||
Position f32.Point
|
||||
Position image.Point
|
||||
// Start is when the press began.
|
||||
Start time.Time
|
||||
// End is when the press was ended by a release or cancel.
|
||||
|
||||
@@ -297,7 +297,7 @@ func drawInk(gtx layout.Context, c widget.Press) {
|
||||
ink := paint.ColorOp{Color: rgba}
|
||||
ink.Add(gtx.Ops)
|
||||
rr := size * .5
|
||||
defer op.Offset(c.Position.Add(f32.Point{
|
||||
defer op.Offset(layout.FPt(c.Position).Add(f32.Point{
|
||||
X: -rr,
|
||||
Y: -rr,
|
||||
})).Push(gtx.Ops).Pop()
|
||||
|
||||
Reference in New Issue
Block a user