fix title display for Frame

This commit is contained in:
Vladimir Markelov 2018-10-09 08:43:09 -07:00
parent a83e4ab41b
commit bc8d1ba9f9

View File

@ -99,10 +99,10 @@ func (f *Frame) Draw() {
defer PopAttributes() defer PopAttributes()
x, y, w, h := f.Clipper() x, y, w, h := f.Clipper()
fx, fy := f.Pos()
fw, fh := f.Size()
if f.scrollable { if f.scrollable {
_, fy := f.Pos()
_, fh := f.Size()
_, fpy := f.Paddings() _, fpy := f.Paddings()
var dist float64 var dist float64
@ -145,17 +145,15 @@ func (f *Frame) Draw() {
SetTextColor(fg) SetTextColor(fg)
SetBackColor(bg) SetBackColor(bg)
fx, fy := f.Pos()
fw, fh := f.Size()
DrawFrame(fx, fy, fw, fh, f.border) DrawFrame(fx, fy, fw, fh, f.border)
if f.title != "" { if f.title != "" {
str := f.title str := f.title
raw := UnColorizeText(str) raw := UnColorizeText(str)
if xs.Len(raw) > w-2 { if xs.Len(raw) > fw-2 {
str = SliceColorized(str, 0, w-2-3) + "..." str = SliceColorized(str, 0, fw-2-3) + "..."
} }
DrawText(x+1, y, str) DrawText(fx+1, fy, str)
} }
f.DrawChildren() f.DrawChildren()