mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: [API] change op.Offset to take integer coordinates
op.Offset is a convenience function most often used by layouts. Layouts usually operate in integer coordinates, and the float32 version of op.Offset needlessly force conversions from int to float32. This change makes op.Offset take integer coordinates, to better match its intended use. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ func (d *Draggable) Layout(gtx layout.Context, w, drag layout.Widget) layout.Dim
|
||||
|
||||
if drag != nil && d.drag.Pressed() {
|
||||
rec := op.Record(gtx.Ops)
|
||||
op.Offset(pos).Add(gtx.Ops)
|
||||
op.Offset(pos.Round()).Add(gtx.Ops)
|
||||
drag(gtx)
|
||||
op.Defer(gtx.Ops, rec.Stop())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user