move sanToRole to keyboardMove

pull/6843/head
Niklas Fiekas 2020-06-18 23:59:27 +02:00
parent 6855d74abb
commit 4a71499265
2 changed files with 9 additions and 10 deletions

View File

@ -33,15 +33,6 @@ export const roleToSan = {
king: 'K'
};
export const sanToRole: { [key: string]: 'pawn' | 'knight' | 'bishop' | 'rook' | 'queen' | 'king' } = {
P: 'pawn',
N: 'knight',
B: 'bishop',
R: 'rook',
Q: 'queen',
K: 'king'
};
export const altCastles = {
e1a1: 'e1c1',
e1h1: 'e1g1',

View File

@ -1,5 +1,4 @@
import { h } from 'snabbdom'
import { sanToRole } from 'chess'
import * as cg from 'chessground/types';
import { Step, Redraw } from './interfaces';
import RoundController from './ctrl';
@ -27,6 +26,15 @@ export interface KeyboardMove {
clock(): ClockController | undefined;
}
const sanToRole: { [key: string]: cg.Role } = {
P: 'pawn',
N: 'knight',
B: 'bishop',
R: 'rook',
Q: 'queen',
K: 'king',
};
export function ctrl(root: RoundController, step: Step, redraw: Redraw): KeyboardMove {
let focus = false;
let handler: KeyboardMoveHandler | undefined;