widget: add Draggable.Pos

When the position of the cursor is required while dragging
a widget around, the pointer's cannot be tracked as the drag
grabs the event priority. Therefore, this patch exposes
the drag's current position.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2022-01-06 19:16:17 +01:00
committed by Elias Naur
parent 8d8aeef66b
commit 4c6d98879e
+5
View File
@@ -96,3 +96,8 @@ func (d *Draggable) Offer(ops *op.Ops, mime string, data io.ReadCloser) {
Data: data,
}.Add(ops)
}
// Pos returns the drag position relative to its area.
func (d *Draggable) Pos() f32.Point {
return d.pos.Add(d.click)
}