commit 9d4f66b20dfe3daa109572467db58c3377dd62ed
parent b30038a91a2813be8a5eb5ab0b1b6f4534670f26
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 2 Jun 2023 08:15:34 -0700
improve board coords
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/pkg/web/handlers/api/v1/chess.go b/pkg/web/handlers/api/v1/chess.go
@@ -163,15 +163,17 @@ func renderSquare(ctx *gg.Context, sq chess.Square, last *chess.Move, turn chess
ctx.SetColor(color.RGBA{R: 0, G: 0, B: 0, A: 180})
if isFlipped {
if sq.Rank() == chess.Rank8 {
- ctx.DrawString(sq.File().String(), float64(x+1), float64(y+sqSize-1))
- } else if sq.File() == chess.FileH {
- ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+sqSize-1))
+ ctx.DrawString(sq.File().String(), float64(x+sqSize-7), float64(y+sqSize-1))
+ }
+ if sq.File() == chess.FileH {
+ ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+11))
}
} else {
if sq.Rank() == chess.Rank1 {
- ctx.DrawString(sq.File().String(), float64(x+1), float64(y+sqSize-1))
- } else if sq.File() == chess.FileA {
- ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+sqSize-1))
+ ctx.DrawString(sq.File().String(), float64(x+sqSize-7), float64(y+sqSize-1))
+ }
+ if sq.File() == chess.FileA {
+ ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+11))
}
}
ctx.Pop()