mirror of
https://github.com/wagoodman/dive
synced 2026-03-16 15:25:51 +01:00
31 lines
573 B
Go
31 lines
573 B
Go
package components
|
|
|
|
import (
|
|
"github.com/rivo/tview"
|
|
)
|
|
|
|
type Visiblility interface {
|
|
Visible() bool
|
|
}
|
|
|
|
type VisiblePrimitive interface {
|
|
tview.Primitive
|
|
Visiblility
|
|
}
|
|
|
|
type VisibleFunc func(tview.Primitive) bool
|
|
|
|
func Always(alwaysVal bool) VisibleFunc {
|
|
return func (_ tview.Primitive) bool {
|
|
return alwaysVal
|
|
}
|
|
}
|
|
|
|
func MinHeightVisibility(minHeight int) VisibleFunc {
|
|
return func(p tview.Primitive) bool {
|
|
_, _, _, height := p.GetRect()
|
|
return height >= minHeight
|
|
}
|
|
}
|
|
|
|
|