Skip to content

Commit

Permalink
Fix relative coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
yishn committed Mar 20, 2020
1 parent 11bbc6b commit 4d95db6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/Goban.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,24 @@ export default class Goban extends Component {
let relativeCoord = (x, size) => {
let halfSize = Math.ceil(size / 2)
let ix = size - x + 1
if (x <= halfSize && x < 10) return x.toString()
else if (ix < halfSize && ix < 10) return `${ix}*`
else return 'X'
if (ix < halfSize) return `${ix}*`
return x.toString()
}

return [
x => relativeCoord(x + 1, board.width),
y => relativeCoord(board.height - y, board.height)
y => relativeCoord(y + 1, board.height)
]
} else {
return [x => alpha[x], y => board.height - y] // A1
return [x => alpha[x], y => board.height - y] // Default
}
}

let coordinatesType = setting.get('view.coordinates_type')
let coordTransformer = getCoordFunctions(coordinatesType)
let coordFunctions = getCoordFunctions(coordinatesType)
let {coordX, coordY} = gobantransformer.transformCoords(
coordTransformer[0],
coordTransformer[1],
coordFunctions[0],
coordFunctions[1],
transformation,
board.width,
board.height
Expand Down

0 comments on commit 4d95db6

Please sign in to comment.