widget: fix handling of disabled context in Draggable

While here, add an example on how to use the Draggable
widget.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2021-12-09 16:22:34 +01:00
committed by Elias Naur
parent 27e38154a0
commit 038ec2cc3f
2 changed files with 88 additions and 0 deletions
+3
View File
@@ -26,6 +26,9 @@ type Draggable struct {
}
func (d *Draggable) Layout(gtx layout.Context, w, drag layout.Widget) layout.Dimensions {
if gtx.Queue == nil {
return w(gtx)
}
pos := d.pos
for _, ev := range d.drag.Events(gtx.Metric, gtx.Queue, gesture.Both) {
switch ev.Type {