mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-20 22:14:35 -04:00
fix(tracker/gioui): cancel dialog when user clicks outside it
This commit is contained in:
parent
b4ec136ab1
commit
ba281ca7c0
@ -81,7 +81,7 @@ func (d *Dialog) Layout(gtx C) D {
|
|||||||
}
|
}
|
||||||
d.handleKeys(gtx)
|
d.handleKeys(gtx)
|
||||||
paint.Fill(gtx.Ops, d.Style.Bg)
|
paint.Fill(gtx.Ops, d.Style.Bg)
|
||||||
return layout.Center.Layout(gtx, func(gtx C) D {
|
dims := layout.Center.Layout(gtx, func(gtx C) D {
|
||||||
return Popup(d.Theme, &d.State.visible).Layout(gtx, func(gtx C) D {
|
return Popup(d.Theme, &d.State.visible).Layout(gtx, func(gtx C) D {
|
||||||
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
|
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
|
||||||
layout.Rigid(func(gtx C) D {
|
layout.Rigid(func(gtx C) D {
|
||||||
@ -117,6 +117,10 @@ func (d *Dialog) Layout(gtx C) D {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
if !d.State.visible {
|
||||||
|
d.Btns[d.NumBtns-1].Action.Do()
|
||||||
|
}
|
||||||
|
return dims
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Dialog) handleKeys(gtx C) {
|
func (d *Dialog) handleKeys(gtx C) {
|
||||||
|
Reference in New Issue
Block a user