Add Padding to Block

This commit is contained in:
gizak 2015-02-04 16:57:24 -05:00
parent cc6b38d600
commit 821cc1f44b

View File

@ -13,6 +13,10 @@ type Block struct {
innerHeight int
innerX int
innerY int
PaddingTop int
PaddingBottom int
PaddingLeft int
PaddingRight int
}
func NewBlock() *Block {
@ -25,10 +29,10 @@ func NewBlock() *Block {
}
func (d *Block) align() {
d.innerWidth = d.Width
d.innerHeight = d.Height
d.innerX = d.X
d.innerY = d.Y
d.innerWidth = d.Width - d.PaddingLeft - d.PaddingRight
d.innerHeight = d.Height - d.PaddingTop - d.PaddingBottom
d.innerX = d.X + d.PaddingLeft
d.innerY = d.Y + d.PaddingTop
if d.HasBorder {
d.innerHeight -= 2