From f0f391356cebc870510f2790f4c00746db9abdf7 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Fri, 1 Mar 2024 23:25:30 +0200 Subject: [PATCH] fix(gioui): arrow keys leave table row/col titles --- tracker/gioui/scroll_table.go | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/tracker/gioui/scroll_table.go b/tracker/gioui/scroll_table.go index 3410c62..958e647 100644 --- a/tracker/gioui/scroll_table.go +++ b/tracker/gioui/scroll_table.go @@ -24,8 +24,6 @@ type ScrollTable struct { Table tracker.Table focused bool requestFocus bool - colTag bool - rowTag bool cursorMoved bool } @@ -160,13 +158,7 @@ func (s *ScrollTableStyle) handleEvents(gtx layout.Context) { for { e, ok := gtx.Event( - key.FocusFilter{ - Target: &s.ScrollTable.rowTag, - }, - key.Filter{ - Focus: &s.ScrollTable.rowTag, - Name: "→", - }, + key.Filter{Focus: s.ScrollTable.RowTitleList, Name: "→"}, ) if !ok { break @@ -178,13 +170,7 @@ func (s *ScrollTableStyle) handleEvents(gtx layout.Context) { for { e, ok := gtx.Event( - key.FocusFilter{ - Target: &s.ScrollTable.colTag, - }, - key.Filter{ - Focus: &s.ScrollTable.colTag, - Name: "↓", - }, + key.Filter{Focus: s.ScrollTable.ColTitleList, Name: "↓"}, ) if !ok { break @@ -225,8 +211,6 @@ func (s *ScrollTableStyle) layoutRowTitles(gtx C, p image.Point) { gtx.Constraints.Min.X = p.X gtx.Constraints.Max.Y -= p.Y gtx.Constraints.Min.Y = gtx.Constraints.Max.Y - defer clip.Rect(image.Rectangle{Max: gtx.Constraints.Max}).Push(gtx.Ops).Pop() - event.Op(gtx.Ops, &s.ScrollTable.rowTag) s.RowTitleStyle.Layout(gtx) } @@ -235,8 +219,6 @@ func (s *ScrollTableStyle) layoutColTitles(gtx C, p image.Point) { gtx.Constraints.Min.Y = p.Y gtx.Constraints.Max.X -= p.X gtx.Constraints.Min.X = gtx.Constraints.Max.X - defer clip.Rect(image.Rectangle{Max: gtx.Constraints.Max}).Push(gtx.Ops).Pop() - event.Op(gtx.Ops, &s.ScrollTable.colTag) s.ColTitleStyle.Layout(gtx) }