From dcaf9919e4e2e90d6711716994c2c46ad5b68298 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 14 Feb 2023 02:14:52 -0500 Subject: [PATCH] Fix thos issue --- elements/core/core.go | 1 + elements/fun/clock.go | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/elements/core/core.go b/elements/core/core.go index 937db24..7ca4bd4 100644 --- a/elements/core/core.go +++ b/elements/core/core.go @@ -113,6 +113,7 @@ func (control CoreControl) HasImage () (has bool) { // DamageRegion pushes the selected region of pixels to the parent element. This // does not need to be called when responding to a resize event. func (control CoreControl) DamageRegion (bounds image.Rectangle) { + if control.core.canvas == nil { return } if control.core.onDamage != nil { control.core.onDamage(canvas.Cut(control.core.canvas, bounds)) } diff --git a/elements/fun/clock.go b/elements/fun/clock.go index 2007231..066af12 100644 --- a/elements/fun/clock.go +++ b/elements/fun/clock.go @@ -61,7 +61,7 @@ func (element *AnalogClock) draw () { state := theme.PatternState { } pattern := element.theme.Pattern(theme.PatternSunken, state) inset := element.theme.Inset(theme.PatternSunken) - artist.FillRectangle(element, pattern, bounds) + artist.FillRectangle(element.core, pattern, bounds) bounds = inset.Apply(bounds) @@ -107,6 +107,5 @@ func (element *AnalogClock) radialLine ( max := element.Bounds().Min.Add(image.Pt ( int(math.Cos(radian) * outer * width + width), int(math.Sin(radian) * outer * height + height))) - // println(min.String(), max.String()) - artist.Line(element, source, 1, min, max) + artist.Line(element.core, source, 1, min, max) }