From 6c3230c0f8a5ca44ce2d7ec5fe0bc917638f7dad Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 2 Apr 2023 22:16:12 -0400 Subject: [PATCH] Fixed CoreControl background drawing behavior ... But found a bug with the border pattern --- elements/core/core.go | 2 +- elements/testing/artist.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/elements/core/core.go b/elements/core/core.go index eeb77a8..fbe033b 100644 --- a/elements/core/core.go +++ b/elements/core/core.go @@ -140,7 +140,7 @@ func (control CoreControl) DrawBackgroundBounds ( if ok { parent.DrawBackground(bounds) } else if fallback != nil { - fallback.Draw(control, bounds) + fallback.Draw(canvas.Cut(control, bounds), control.Bounds()) } } diff --git a/elements/testing/artist.go b/elements/testing/artist.go index 02f9fc3..15a26e9 100644 --- a/elements/testing/artist.go +++ b/elements/testing/artist.go @@ -123,6 +123,17 @@ func (element *Artist) draw () { Inset: artist.Inset { 8, 8, 8, 8 }, }.Draw(c13, c13.Bounds().Inset(10)) + // 2, 3 + c23 := element.cellAt(2, 3) + patterns.Border { + Canvas: element.thingy(c42), + Inset: artist.Inset { 8, 8, 8, 8 }, + }.Draw(c23, c23.Bounds()) + patterns.Border { + Canvas: element.thingy(c42), + Inset: artist.Inset { 8, 8, 8, 8 }, + }.Draw(canvas.Cut(c23, c23.Bounds().Inset(16)), c23.Bounds()) + // how long did that take to render? drawTime := time.Since(drawStart) textDrawer := textdraw.Drawer { }