dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 9888c68c43e01cf40adf9c7e68c06de114b58c3c
parent 9d4f66b20dfe3daa109572467db58c3377dd62ed
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri,  2 Jun 2023 08:51:35 -0700

simplify code

Diffstat:
Mpkg/web/handlers/api/v1/chess.go | 19+++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/pkg/web/handlers/api/v1/chess.go b/pkg/web/handlers/api/v1/chess.go @@ -161,20 +161,11 @@ func renderSquare(ctx *gg.Context, sq chess.Square, last *chess.Move, turn chess ctx.Push() 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+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+sqSize-7), float64(y+sqSize-1)) - } - if sq.File() == chess.FileA { - ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+11)) - } + if (!isFlipped && sq.Rank() == chess.Rank1) || (isFlipped && sq.Rank() == chess.Rank8) { + ctx.DrawString(sq.File().String(), float64(x+sqSize-7), float64(y+sqSize-1)) + } + if (!isFlipped && sq.File() == chess.FileA) || (isFlipped && sq.File() == chess.FileH) { + ctx.DrawString(sq.Rank().String(), float64(x+1), float64(y+11)) } ctx.Pop()