Merge pull request #21 from boppreh/master
Fix layout.go in regard to new padding and margin
This commit is contained in:
commit
c401617637
|
@ -1,14 +1,12 @@
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
// Recursively removes border margins and padding from controls, replaces
|
// Recursively replaces nils with stretchy empty spaces and changes the orientation
|
||||||
// nil values with stretchy spaces and reorients nested stack to have
|
// of inner stack so they are perpenticular to each other.
|
||||||
// opposing orientations.
|
|
||||||
func resetControls(parent *Stack) {
|
func resetControls(parent *Stack) {
|
||||||
for i, control := range parent.controls {
|
for i, control := range parent.controls {
|
||||||
switch control.(type) {
|
switch control.(type) {
|
||||||
case *Stack:
|
case *Stack:
|
||||||
stack := control.(*Stack)
|
stack := control.(*Stack)
|
||||||
stack.borderMargin = 0
|
|
||||||
stack.orientation = !parent.orientation
|
stack.orientation = !parent.orientation
|
||||||
resetControls(stack)
|
resetControls(stack)
|
||||||
case nil:
|
case nil:
|
||||||
|
@ -30,8 +28,6 @@ func Layout(controls ...Control) *Stack {
|
||||||
stretchy: make([]bool, len(controls)),
|
stretchy: make([]bool, len(controls)),
|
||||||
width: make([]int, len(controls)),
|
width: make([]int, len(controls)),
|
||||||
height: make([]int, len(controls)),
|
height: make([]int, len(controls)),
|
||||||
padding: 10,
|
|
||||||
borderMargin: 15,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetControls(stack)
|
resetControls(stack)
|
||||||
|
|
Loading…
Reference in New Issue