~pierrec/giox

48c9bba996f16f7312c652d7c4bf7dae3f697f16 — pierre 6 months ago 8b5b6cd
widgetx: Modal only check keys upon release

Signed-off-by: pierre <pierre.curto@gmail.com>
1 files changed, 8 insertions(+), 6 deletions(-)

M widgetx/modal.go
M widgetx/modal.go => widgetx/modal.go +8 -6
@@ 35,12 35,14 @@ func (m *Modal) update(gtx layout.Context) {
		return
	}
	for _, ev := range gtx.Events(m) {
		if e, ok := ev.(key.Event); ok {
			for _, k := range m.Keys {
				if e.Name == k {
					m.changed = true
					return
				}
		e, ok := ev.(key.Event)
		if !ok || e.State != key.Release {
			continue
		}
		for _, k := range m.Keys {
			if e.Name == k {
				m.changed = true
				return
			}
		}
	}