sampler-fork/layout/component.go

32 lines
424 B
Go
Raw Normal View History

2019-01-31 00:02:38 +00:00
package layout
import (
. "github.com/sqshq/termui"
)
2019-01-31 01:41:51 +00:00
type Component struct {
Drawable Drawable
2019-01-31 00:02:38 +00:00
Position Position
Size Size
}
type Position struct {
X int `yaml:"x"`
Y int `yaml:"y"`
}
type Size struct {
X int `yaml:"x"`
Y int `yaml:"y"`
}
2019-01-31 01:41:51 +00:00
func (self *Component) Move(x, y int) {
2019-01-31 00:02:38 +00:00
self.Position.X += x
self.Position.Y += y
}
2019-01-31 01:41:51 +00:00
func (self *Component) Resize(x, y int) {
2019-01-31 00:02:38 +00:00
self.Size.X += x
self.Size.Y += y
}