Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flex.ResizeItemAt #801

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Flex struct {
// background before any items are drawn, set it to a box with the desired
// color:
//
// flex.Box = NewBox()
// flex.Box = NewBox()
func NewFlex() *Flex {
f := &Flex{
direction: FlexColumn,
Expand Down Expand Up @@ -137,6 +137,15 @@ func (f *Flex) ResizeItem(p Primitive, fixedSize, proportion int) *Flex {
return f
}

// ResizeItemAt sets a new size for the item ath the given index.
// For details regarding the size parameters, see AddItem().
func (f *Flex) ResizeItemAt(index int, fixedSize, proportion int) *Flex {
item := f.items[index]
item.FixedSize = fixedSize
item.Proportion = proportion
return f
}

// Draw draws this primitive onto the screen.
func (f *Flex) Draw(screen tcell.Screen) {
f.Box.DrawForSubclass(screen, f)
Expand Down