Commit 74222a8a authored by Derek Schaab's avatar Derek Schaab

Use separate variables for text coordinates

parent 2052062d
......@@ -59,7 +59,7 @@ func WriteSVG(w io.Writer, g chess.Game, o Options) (err error) {
dst.writeDefs(g, rowSize, rowSizeStr, lightRGBAStr, darkRGBAStr)
var file, rank rune
var x, y []byte
var x, y, tx, ty []byte
var p chess.Piece
for s := chess.First; s <= chess.Last; s++ {
file, rank = s.File(), s.Rank()
......@@ -70,11 +70,11 @@ func WriteSVG(w io.Writer, g chess.Game, o Options) (err error) {
dst.writeSquareBackground(x, y, dark)
if file == 'a' || rank == '1' {
x, y = labelXCoordStrs[int(file-'a')], labelYCoordStrs[int('8'-rank)]
tx, ty = labelXCoordStrs[int(file-'a')], labelYCoordStrs[int('8'-rank)]
if s.Light() {
dst.writeSquareLabel(file, rank, x, y, darkRGBAStr)
dst.writeSquareLabel(file, rank, tx, ty, darkRGBAStr)
} else {
dst.writeSquareLabel(file, rank, x, y, lightRGBAStr)
dst.writeSquareLabel(file, rank, tx, ty, lightRGBAStr)
p = g.Board[s]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment