Add: status page screen change support
This commit is contained in:
@ -50,7 +50,6 @@ func (t *text) Clear() {
|
||||
}
|
||||
|
||||
func (t *text) Draw() {
|
||||
t.Clear() // Assume that is draw is invoked string has been changed
|
||||
t.drawer.PutText(t.rect.x, t.rect.y, t.str)
|
||||
t.drawer.GetDisplay().FlushByMask(t.mask.bits)
|
||||
}
|
||||
@ -61,9 +60,18 @@ func (t *text) updateW() {
|
||||
|
||||
func (t *text) SetStr(str string) {
|
||||
t.str = str
|
||||
t.updateW()
|
||||
t.mask.Update(t.rect)
|
||||
newW := len(t.str)*(drawer.FontCharW+drawer.CharGap) - drawer.CharGap
|
||||
if t.rect.w-newW > 0 {
|
||||
// Need to clear some space
|
||||
t.Clear()
|
||||
t.drawer.FillBar(t.rect.x+newW, t.rect.y, t.rect.x+t.rect.w, t.rect.y+t.rect.h, 0)
|
||||
} else {
|
||||
t.rect.w = newW
|
||||
t.mask.Update(t.rect)
|
||||
}
|
||||
t.Draw()
|
||||
t.rect.w = newW
|
||||
t.mask.Update(t.rect)
|
||||
}
|
||||
|
||||
func (t *text) GetPos() (int, int) {
|
||||
|
Reference in New Issue
Block a user