Grid draws in the empty areas around the cells
This commit is contained in:
parent
ce7584ceee
commit
1616c615bf
|
@ -40,6 +40,7 @@ type Grid struct {
|
|||
stride int
|
||||
cellWidth int
|
||||
cellHeight int
|
||||
gridBounds image.Rectangle
|
||||
|
||||
cursor image.Point
|
||||
|
||||
|
@ -147,6 +148,11 @@ func (element *Grid) alloc () bool {
|
|||
height := bounds.Dy() / element.cellHeight
|
||||
oldWidth, oldHeight := element.Size()
|
||||
if width == oldWidth && height == oldHeight { return false }
|
||||
|
||||
element.gridBounds = image.Rect (
|
||||
0, 0,
|
||||
width * element.cellWidth,
|
||||
height * element.cellHeight).Add(bounds.Min)
|
||||
|
||||
oldCells := element.cells
|
||||
heightLarger := height > oldHeight
|
||||
|
@ -249,5 +255,12 @@ func (element *Grid) draw (force bool) image.Rectangle {
|
|||
element.bound(index))
|
||||
}}
|
||||
|
||||
if force {
|
||||
shapes.FillColorRectangleShatter (
|
||||
element.core,
|
||||
element.theme.Color(tomo.ColorBackground, element.state()),
|
||||
bounds, element.gridBounds)
|
||||
}
|
||||
|
||||
return bounds // FIXME
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ func (element *Terminal) handleResize () {
|
|||
Background: tomo.ColorRed,
|
||||
Foreground: tomo.ColorBlack,
|
||||
})
|
||||
element.Set(image.Pt(15, 10), Cell {
|
||||
Rune: 'Y',
|
||||
Background: tomo.ColorBrightBlue,
|
||||
Foreground: tomo.ColorBlack,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue