TextBox properly gives attributes values to the typeset drawer

This commit is contained in:
Sasha Koshka 2024-07-26 00:27:32 -04:00
parent 4f89b11799
commit 37ec962d1f

View File

@ -109,10 +109,10 @@ func (this *textBox) Draw (can canvas.Canvas) {
if col == nil { col = color.Transparent } if col == nil { col = color.Transparent }
this.drawBorders(can) this.drawBorders(can)
pen := can.Pen() pen := can.Pen()
pen.Fill(col) pen.Fill(col)
pen.Texture(texture) pen.Texture(texture)
if this.transparent() && this.parent != nil { if this.transparent() && this.parent != nil {
this.parent.drawBackgroundPart(can) this.parent.drawBackgroundPart(can)
} }
@ -143,6 +143,7 @@ func (this *textBox) setAttr (attr tomo.Attr, user bool) {
case tomo.AttrFace: case tomo.AttrFace:
if this.attrFace.Set(attr, user) { if this.attrFace.Set(attr, user) {
println("face set")
this.drawer.SetFace(attr.Face) this.drawer.SetFace(attr.Face)
this.invalidateMinimum() this.invalidateMinimum()
this.invalidateLayout() this.invalidateLayout()
@ -150,12 +151,16 @@ func (this *textBox) setAttr (attr tomo.Attr, user bool) {
case tomo.AttrWrap: case tomo.AttrWrap:
if this.attrWrap.Set(attr, user) { if this.attrWrap.Set(attr, user) {
this.drawer.SetWrap(bool(attr))
this.invalidateMinimum() this.invalidateMinimum()
this.invalidateLayout() this.invalidateLayout()
} }
case tomo.AttrAlign: case tomo.AttrAlign:
if this.attrAlign.Set(attr, user) { if this.attrAlign.Set(attr, user) {
this.drawer.SetAlign (
typeset.Align(attr.X),
typeset.Align(attr.Y))
this.invalidateDraw() this.invalidateDraw()
} }