Add Padding to Block
This commit is contained in:
parent
cc6b38d600
commit
821cc1f44b
12
block.go
12
block.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user