mirror of https://github.com/gizak/termui.git
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]
|
## [Unreleased]
|
||||||
|
|
||||||
## 2019/02/23
|
## 2019/02/28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add `ColumnResizer` to table which allows for custom column sizing
|
||||||
|
- Add widget padding
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Change various widget field names
|
- Change various widget field names
|
||||||
- s/TextParse/ParseStyles
|
- s/`TextParse`/`ParseStyles`
|
||||||
- Remove AddColorMap in place of modifying StyleParserColorMap directly
|
- Remove `AddColorMap` in place of modifying `StyleParserColorMap` directly
|
||||||
|
|
||||||
## 2019/01/31
|
## 2019/01/31
|
||||||
|
|
||||||
|
|
15
block.go
15
block.go
|
@ -15,10 +15,10 @@ import (
|
||||||
type Block struct {
|
type Block struct {
|
||||||
Border bool
|
Border bool
|
||||||
BorderStyle Style
|
BorderStyle Style
|
||||||
BorderLeft bool
|
|
||||||
BorderRight bool
|
BorderLeft, BorderRight, BorderTop, BorderBottom bool
|
||||||
BorderTop bool
|
|
||||||
BorderBottom bool
|
PaddingLeft, PaddingRight, PaddingTop, PaddingBottom int
|
||||||
|
|
||||||
image.Rectangle
|
image.Rectangle
|
||||||
Inner image.Rectangle
|
Inner image.Rectangle
|
||||||
|
@ -88,7 +88,12 @@ func (self *Block) Draw(buf *Buffer) {
|
||||||
// SetRect implements the Drawable interface.
|
// SetRect implements the Drawable interface.
|
||||||
func (self *Block) SetRect(x1, y1, x2, y2 int) {
|
func (self *Block) SetRect(x1, y1, x2, y2 int) {
|
||||||
self.Rectangle = image.Rect(x1, y1, x2, y2)
|
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.
|
// GetRect implements the Drawable interface.
|
||||||
|
|
Loading…
Reference in New Issue