From dc4962a6c4ef5ea32545128775a1f860e630ccc9 Mon Sep 17 00:00:00 2001 From: Greg Pomerantz Date: Sun, 10 May 2026 07:32:15 -0400 Subject: [PATCH] Fix icon Y positioning: offset by icon height to align bottom with baseline - drawPng uses top-left corner, drawText uses baseline - Icon bottom (Y=42) now aligns with baseline at Y=42 - Icon top is at Y=26 (42-16), occupies Y=26 to Y=42 --- internal/ui/render.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/ui/render.go b/internal/ui/render.go index 728bde3..5be6278 100644 --- a/internal/ui/render.go +++ b/internal/ui/render.go @@ -2,7 +2,9 @@ package ui import ( "bytes" + "embed" + "fmt" "image" "image/color" @@ -181,9 +183,12 @@ func (r *Renderer) drawStatusBar(gtx layout.Context, sb StatusBar, _ WindowConst iconY := iconsLineY iconSize := Dp(16) + fmt.Printf("[DEBUG drawStatusBar] reg=(%d, %d, %d, %d) filenameLineY=%d iconsLineY=%d iconY=%d iconSize=%d scale=%f\n", + reg.X, reg.Y, reg.W, reg.H, filenameLineY, iconsLineY, iconY, iconSize, r.scale) // Icon Y is baseline position; drawPng uses top-left, so offset by icon height - r.drawPng(gtx, r.icons["cut"], leftX, iconY, iconSize, iconSize, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) + // drawPng uses top-left, drawText uses baseline — offset by icon height + r.drawPng(gtx, r.icons["cut"], leftX, iconY-iconSize, iconSize, iconSize, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) leftX += Dp(36) r.drawText(gtx, th.Shaper, "⎘", r.theme.FontSize, leftX, iconY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) leftX += Dp(36) @@ -400,6 +405,7 @@ type WindowConstraints struct { // col is the tint color — if alpha < 255, the image is tinted using blendOp.DstIn. func (r *Renderer) drawPng(gtx layout.Context, img image.Image, x, y Dp, width, height Dp, col color.NRGBA) { if img == nil { + fmt.Printf("[DEBUG drawPng] SKIPPED: img is nil\n") return } @@ -408,6 +414,8 @@ func (r *Renderer) drawPng(gtx layout.Context, img image.Image, x, y Dp, width, yPx := int(r.toPx(y)) wPx := int(r.toPx(width)) hPx := int(r.toPx(height)) + fmt.Printf("[DEBUG drawPng] Dp=(%d, %d, %d, %d) Px=(%d, %d, %d, %d) scale=%f\n", + x, y, width, height, xPx, yPx, wPx, hPx, r.scale) // Compute destination rectangle dst := image.Rect(xPx, yPx, xPx+wPx, yPx+hPx)