atomize-element-interface #2

Merged
sashakoshka merged 20 commits from atomize-element-interface into main 2023-01-16 17:24:23 +00:00
Showing only changes of commit 1378093c12 - Show all commits

View File

@ -64,9 +64,10 @@ func (core *Core) SetParentHooks (hooks tomo.ParentHooks) {
core.hooks = hooks
}
// CoreControl is a struct that can exert control over a control struct. It can
// be used as a canvas. It must not be directly embedded into an element, but
// instead kept as a private member.
// CoreControl is a struct that can exert control over a Core struct. It can be
// used as a canvas. It must not be directly embedded into an element, but
// instead kept as a private member. When a Core struct is created, a
// corresponding CoreControl struct is linked to it and returned alongside it.
type CoreControl struct {
tomo.BasicCanvas
core *Core
@ -90,7 +91,8 @@ func (control CoreControl) PushAll () {
control.PushRegion(control.Bounds())
}
// AllocateCanvas resizes the canvas.
// AllocateCanvas resizes the canvas, constraining the width and height so that
// they are not less than the specified minimum width and height.
func (control *CoreControl) AllocateCanvas (width, height int) {
width, height, _ = control.ConstrainSize(width, height)
control.core.canvas = tomo.NewBasicCanvas(width, height)