feat(tracker): make clicks change the focused panel

This commit is contained in:
vsariola
2021-02-14 21:32:27 +02:00
parent 07052f2530
commit c60f6e0f0e
3 changed files with 73 additions and 1 deletions

View File

@ -14,7 +14,23 @@ import (
"golang.org/x/exp/shiny/materialdesign/icons"
)
var instrumentPointerTag = false
func (t *Tracker) layoutInstruments(gtx C) D {
for _, ev := range gtx.Events(&instrumentPointerTag) {
e, ok := ev.(pointer.Event)
if !ok {
continue
}
if e.Type == pointer.Press {
t.EditMode = EditUnits
}
}
rect := image.Rect(0, 0, gtx.Constraints.Max.X, gtx.Constraints.Max.Y)
pointer.Rect(rect).Add(gtx.Ops)
pointer.InputOp{Tag: &instrumentPointerTag,
Types: pointer.Press,
}.Add(gtx.Ops)
if t.CurrentInstrument > 7 {
t.InstrumentDragList.List.Position.First = t.CurrentInstrument - 7
} else {