mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget: report Enum.Changed only when actually changed
Fixes gio#159 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-2
@@ -50,8 +50,10 @@ func (e *Enum) Layout(gtx layout.Context, key string) layout.Dimensions {
|
||||
for _, ev := range clk.Events(gtx) {
|
||||
switch ev.Type {
|
||||
case gesture.TypeClick:
|
||||
e.Value = e.values[idx]
|
||||
e.changed = true
|
||||
if new := e.values[idx]; new != e.Value {
|
||||
e.Value = new
|
||||
e.changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
clk.Add(gtx.Ops)
|
||||
|
||||
Reference in New Issue
Block a user