Update BottomBar to use drawText instead of material.Label

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Greg Pomerantz 2026-05-09 15:53:14 -04:00
parent 99b4db919b
commit 9476f5448a
2 changed files with 8 additions and 11 deletions

View File

@ -145,26 +145,22 @@ func (r *Renderer) drawStatusBar(gtx layout.Context, sb StatusBar) {
func (r *Renderer) drawBottomBar(gtx layout.Context, bb BottomBar) {
reg := bb.Region()
th := material.NewTheme()
th.Shaper = r.shp
// BottomBar text at reg.Y (top of bar), using drawText for consistent rendering.
// The BottomBar region is at the bottom of the screen with 10DP margin.
bottomY := reg.Y
// Left: Cursor position
cursorX := reg.X + unit.Dp(8)
call1 := op.Offset(image.Point{X: int(cursorX), Y: int(reg.Y)}).Push(gtx.Ops)
material.Label(th, r.theme.FontSize, bb.CursorPos).Layout(gtx)
call1.Pop()
r.drawText(gtx, r.shp, bb.CursorPos, r.theme.FontSize, cursorX, bottomY, color.NRGBA{R: 0, G: 0, B: 0, A: 255})
// Center: Byte position
byteX := reg.X + reg.W/2 - unit.Dp(60) // approximate center
call2 := op.Offset(image.Point{X: int(byteX), Y: int(reg.Y)}).Push(gtx.Ops)
material.Label(th, r.theme.FontSize, bb.BytePos).Layout(gtx)
call2.Pop()
r.drawText(gtx, r.shp, bb.BytePos, r.theme.FontSize, byteX, bottomY, color.NRGBA{R: 0, G: 0, B: 0, A: 255})
// Right: Word wrap button
wordWrapX := reg.X + reg.W - unit.Dp(80)
call3 := op.Offset(image.Point{X: int(wordWrapX), Y: int(reg.Y)}).Push(gtx.Ops)
material.Label(th, r.theme.FontSize, "W:"+boolToString(bb.WordWrap)).Layout(gtx)
call3.Pop()
r.drawText(gtx, r.shp, "W:"+boolToString(bb.WordWrap), r.theme.FontSize, wordWrapX, bottomY, color.NRGBA{R: 0, G: 0, B: 0, A: 255})
}
func (r *Renderer) drawButton(gtx layout.Context, btn Button) {
@ -323,3 +319,4 @@ func charWidths(gtx layout.Context, shp *text.Shaper, str string, size unit.Sp)
}
return widths
}

BIN
pad

Binary file not shown.