mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
fix(tracker): unit searching to work more reliably
This commit is contained in:
parent
db6c9f6052
commit
2b3f6d8200
@ -373,6 +373,7 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
|
||||
}
|
||||
}
|
||||
t.Units().SetSelectedType(txt)
|
||||
t.UnitSearching().Bool().Set(false)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -384,12 +385,18 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
|
||||
|
||||
defer clip.Rect(image.Rect(0, 0, gtx.Constraints.Max.X, gtx.Constraints.Max.Y)).Push(gtx.Ops).Pop()
|
||||
key.InputOp{Tag: &ie.searchEditor, Keys: globalKeys}.Add(gtx.Ops)
|
||||
txt := u.Type
|
||||
str := tracker.String{StringData: (*tracker.UnitSearch)(t.Model)}
|
||||
if ie.searchEditor.Text() != str.Value() {
|
||||
ie.searchEditor.SetText(str.Value())
|
||||
if t.UnitSearching().Value() {
|
||||
txt = str.Value()
|
||||
}
|
||||
if ie.searchEditor.Text() != txt {
|
||||
ie.searchEditor.SetText(txt)
|
||||
}
|
||||
ret := editor.Layout(gtx)
|
||||
str.Set(ie.searchEditor.Text())
|
||||
if ie.searchEditor.Text() != txt {
|
||||
str.Set(ie.searchEditor.Text())
|
||||
}
|
||||
return ret
|
||||
} else {
|
||||
unitNameLabel := LabelStyle{Text: u.Type, ShadeColor: black, Color: color, Font: labelDefaultFont, FontSize: unit.Sp(12), Shaper: t.Theme.Shaper}
|
||||
|
@ -59,8 +59,8 @@ func (pe *UnitEditor) Layout(gtx C, t *Tracker) D {
|
||||
key.InputOp{Tag: &pe.tag, Keys: "←|Shift-←|→|Shift-→|⎋"}.Add(gtx.Ops)
|
||||
|
||||
editorFunc := pe.layoutSliders
|
||||
str := tracker.String{StringData: (*tracker.UnitSearch)(t.Model)}
|
||||
if str.Value() != t.Model.Units().SelectedType() || pe.sliderList.TrackerList.Count() == 0 {
|
||||
|
||||
if t.UnitSearching().Value() || pe.sliderList.TrackerList.Count() == 0 {
|
||||
editorFunc = pe.layoutUnitTypeChooser
|
||||
}
|
||||
return Surface{Gray: 24, Focus: t.InstrumentEditor.wasFocused}.Layout(gtx, func(gtx C) D {
|
||||
|
Reference in New Issue
Block a user