diff --git a/elements/fun/clock.go b/elements/fun/clock.go index 8bc71f7..1e98029 100644 --- a/elements/fun/clock.go +++ b/elements/fun/clock.go @@ -19,17 +19,11 @@ type AnalogClock struct { // NewAnalogClock creates a new analog clock that displays the specified time. func NewAnalogClock (newTime time.Time) (element *AnalogClock) { element = &AnalogClock { } - element.Core, element.core = core.NewCore(element) + element.Core, element.core = core.NewCore(element.draw) element.core.SetMinimumSize(64, 64) return } -// Resize changes the size of the clock. -func (element *AnalogClock) Resize (width, height int) { - element.core.AllocateCanvas(width, height) - element.draw() -} - // SetTime changes the time that the clock displays. func (element *AnalogClock) SetTime (newTime time.Time) { if newTime == element.time { return } diff --git a/elements/testing/artist.go b/elements/testing/artist.go index 628cd56..145c629 100644 --- a/elements/testing/artist.go +++ b/elements/testing/artist.go @@ -19,13 +19,12 @@ type Artist struct { // NewArtist creates a new artist test element. func NewArtist () (element *Artist) { element = &Artist { } - element.Core, element.core = core.NewCore(element) + element.Core, element.core = core.NewCore(element.draw) element.core.SetMinimumSize(480, 600) return } -func (element *Artist) Resize (width, height int) { - element.core.AllocateCanvas(width, height) +func (element *Artist) draw () { bounds := element.Bounds() element.cellBounds.Max.X = bounds.Dx() / 5 element.cellBounds.Max.Y = (bounds.Dy() - 48) / 8 diff --git a/elements/testing/mouse.go b/elements/testing/mouse.go index 5d3fae8..138238a 100644 --- a/elements/testing/mouse.go +++ b/elements/testing/mouse.go @@ -20,14 +20,13 @@ type Mouse struct { // NewMouse creates a new mouse test element. func NewMouse () (element *Mouse) { element = &Mouse { } - element.Core, element.core = core.NewCore(element) + element.Core, element.core = core.NewCore(element.draw) element.core.SetMinimumSize(32, 32) element.color = artist.NewUniform(color.Black) return } -func (element *Mouse) Resize (width, height int) { - element.core.AllocateCanvas(width, height) +func (element *Mouse) draw () { bounds := element.Bounds() pattern, _ := theme.AccentPattern(theme.PatternState { }) artist.FillRectangle(element.core, pattern, bounds)