io/router: account for parent clip areas when scrolling focus into view

Fixes: https://todo.sr.ht/~eliasnaur/gio/389
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-02 15:49:41 +02:00
parent 36919ef756
commit bd7f50438a
3 changed files with 17 additions and 1 deletions
+3 -1
View File
@@ -274,6 +274,7 @@ func TestFocusScroll(t *testing.T) {
r := new(Router)
h := new(int)
parent := clip.Rect(image.Rect(1, 1, 14, 39)).Push(ops)
cl := clip.Rect(image.Rect(10, -20, 20, 30)).Push(ops)
key.InputOp{Tag: h}.Add(ops)
pointer.InputOp{
@@ -282,12 +283,13 @@ func TestFocusScroll(t *testing.T) {
ScrollBounds: image.Rect(-100, -100, 100, 100),
}.Add(ops)
cl.Pop()
parent.Pop()
r.Frame(ops)
r.MoveFocus(FocusLeft)
r.RevealFocus(image.Rect(0, 0, 15, 40))
evts := r.Events(h)
assertScrollEvent(t, evts[len(evts)-1], f32.Pt(5, -10))
assertScrollEvent(t, evts[len(evts)-1], f32.Pt(6, -9))
}
func TestFocusClick(t *testing.T) {