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) { ...@@ -59,7 +59,7 @@ func WriteSVG(w io.Writer, g chess.Game, o Options) (err error) {
dst.writeDefs(g, rowSize, rowSizeStr, lightRGBAStr, darkRGBAStr) dst.writeDefs(g, rowSize, rowSizeStr, lightRGBAStr, darkRGBAStr)
dst.writeGroupOpenTag(rowSize) dst.writeGroupOpenTag(rowSize)
var file, rank rune var file, rank rune
var x, y []byte var x, y, tx, ty []byte
var p chess.Piece var p chess.Piece
for s := chess.First; s <= chess.Last; s++ { for s := chess.First; s <= chess.Last; s++ {
file, rank = s.File(), s.Rank() file, rank = s.File(), s.Rank()
...@@ -70,11 +70,11 @@ func WriteSVG(w io.Writer, g chess.Game, o Options) (err error) { ...@@ -70,11 +70,11 @@ func WriteSVG(w io.Writer, g chess.Game, o Options) (err error) {
dst.writeSquareBackground(x, y, dark) dst.writeSquareBackground(x, y, dark)
} }
if file == 'a' || rank == '1' { 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() { if s.Light() {
dst.writeSquareLabel(file, rank, x, y, darkRGBAStr) dst.writeSquareLabel(file, rank, tx, ty, darkRGBAStr)
} else { } else {
dst.writeSquareLabel(file, rank, x, y, lightRGBAStr) dst.writeSquareLabel(file, rank, tx, ty, lightRGBAStr)
} }
} }
p = g.Board[s] 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