A few tweaks
This commit is contained in:
@@ -352,28 +352,36 @@ func (w *LinearLayout) updateWidgetLayouts() {
|
||||
// We need to determine the allowed size of this widget so we can determine
|
||||
// it's position
|
||||
func (w *LinearLayout) updateLLVWidgetSize(wd Widget) {
|
||||
if w.stacked {
|
||||
return
|
||||
}
|
||||
rW := w.w
|
||||
if wd == w.widgets[len(w.widgets)-1] {
|
||||
wrk := float64(w.w) / float64(w.totalWeight)
|
||||
if wrk == float64((w.w / w.totalWeight)) {
|
||||
rW -= 1
|
||||
if w.stacked {
|
||||
rW = wd.MinW()
|
||||
} else {
|
||||
if wd == w.widgets[len(w.widgets)-1] {
|
||||
wrk := float64(w.w) / float64(w.totalWeight)
|
||||
if wrk == float64((w.w / w.totalWeight)) {
|
||||
rW -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if wd.Id() == "campaignform.begindate" {
|
||||
w.Log("Setting %s Size: %d,%d", wd.Id(), rW, w.getWeightedH(wd))
|
||||
}
|
||||
wd.HandleResize((&Coord{X: rW, Y: w.getWeightedH(wd)}).ResizeEvent())
|
||||
if wd.Id() == "campaignform.begindate" {
|
||||
w.Log(" %s Size: %d,%d", wd.Id(), wd.GetW(), wd.GetH())
|
||||
}
|
||||
}
|
||||
|
||||
func (w *LinearLayout) updateLLHWidgetSize(wd Widget) {
|
||||
if w.stacked {
|
||||
return
|
||||
}
|
||||
rH := w.h
|
||||
if wd == w.widgets[len(w.widgets)-1] {
|
||||
wrk := float64(w.h) / float64(w.totalWeight)
|
||||
if wrk == float64((w.h / w.totalWeight)) {
|
||||
rH -= 1
|
||||
if w.stacked {
|
||||
rH = wd.MinH()
|
||||
} else {
|
||||
if wd == w.widgets[len(w.widgets)-1] {
|
||||
wrk := float64(w.h) / float64(w.totalWeight)
|
||||
if wrk == float64((w.h / w.totalWeight)) {
|
||||
rH -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
wd.HandleResize((&Coord{X: w.getWeightedW(wd), Y: rH}).ResizeEvent())
|
||||
@@ -399,7 +407,11 @@ func (w *LinearLayout) updateLLVWidgetPos(wd Widget) {
|
||||
var ok bool
|
||||
var flgs LayoutFlag
|
||||
if flgs, ok = w.layoutFlags[wd]; !ok {
|
||||
flgs = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
|
||||
if w.stacked { // If we're 'stacked', set things to top/left
|
||||
flgs = LayoutFlag(LFAlignHLeft | LFAlignVTop)
|
||||
} else {
|
||||
flgs = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
|
||||
}
|
||||
}
|
||||
|
||||
// c.Y is the top of this 'cell'
|
||||
@@ -460,6 +472,8 @@ func (w *LinearLayout) updateLLHWidgetPos(wd Widget) {
|
||||
func (w *LinearLayout) getWeightedH(wd Widget) int {
|
||||
if !w.Contains(wd) {
|
||||
return 0
|
||||
} else if w.stacked {
|
||||
return wd.MinH()
|
||||
}
|
||||
wght := w.layoutWeights[wd]
|
||||
if wght == 0 {
|
||||
@@ -477,6 +491,8 @@ func (w *LinearLayout) getWeightedH(wd Widget) int {
|
||||
func (w *LinearLayout) getWeightedW(wd Widget) int {
|
||||
if !w.Contains(wd) {
|
||||
return 0
|
||||
} else if w.stacked {
|
||||
return wd.MinW()
|
||||
}
|
||||
wght := w.layoutWeights[wd]
|
||||
if wght == 0 {
|
||||
|
||||
Reference in New Issue
Block a user