Add widget padding
This commit is contained in:
parent
9735f6dda8
commit
9513fa11a1
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -6,13 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 2019/02/23
|
||||
## 2019/02/28
|
||||
|
||||
### Added
|
||||
|
||||
- Add `ColumnResizer` to table which allows for custom column sizing
|
||||
- Add widget padding
|
||||
|
||||
### Changed
|
||||
|
||||
- Change various widget field names
|
||||
- s/TextParse/ParseStyles
|
||||
- Remove AddColorMap in place of modifying StyleParserColorMap directly
|
||||
- s/`TextParse`/`ParseStyles`
|
||||
- Remove `AddColorMap` in place of modifying `StyleParserColorMap` directly
|
||||
|
||||
## 2019/01/31
|
||||
|
||||
|
|
15
block.go
15
block.go
|
@ -15,10 +15,10 @@ import (
|
|||
type Block struct {
|
||||
Border bool
|
||||
BorderStyle Style
|
||||
BorderLeft bool
|
||||
BorderRight bool
|
||||
BorderTop bool
|
||||
BorderBottom bool
|
||||
|
||||
BorderLeft, BorderRight, BorderTop, BorderBottom bool
|
||||
|
||||
PaddingLeft, PaddingRight, PaddingTop, PaddingBottom int
|
||||
|
||||
image.Rectangle
|
||||
Inner image.Rectangle
|
||||
|
@ -88,7 +88,12 @@ func (self *Block) Draw(buf *Buffer) {
|
|||
// SetRect implements the Drawable interface.
|
||||
func (self *Block) SetRect(x1, y1, x2, y2 int) {
|
||||
self.Rectangle = image.Rect(x1, y1, x2, y2)
|
||||
self.Inner = image.Rect(self.Min.X+1, self.Min.Y+1, self.Max.X-1, self.Max.Y-1)
|
||||
self.Inner = image.Rect(
|
||||
self.Min.X+1+self.PaddingLeft,
|
||||
self.Min.Y+1+self.PaddingTop,
|
||||
self.Max.X-1+self.PaddingRight,
|
||||
self.Max.Y-1+self.PaddingBottom,
|
||||
)
|
||||
}
|
||||
|
||||
// GetRect implements the Drawable interface.
|
||||
|
|
Loading…
Reference in New Issue
Block a user