update to chessground 7.7.0 (0-based pos)

local-config
Niklas Fiekas 2020-06-25 14:53:51 +02:00
parent dc1bb84ba8
commit 461e480007
14 changed files with 22 additions and 22 deletions

View File

@ -24,7 +24,7 @@
"ceval": "2.0.0",
"chat": "2.0.0",
"chess": "2.0.0",
"chessground": "^7.6",
"chessground": "^7.7.0",
"chessops": "^0.4.2",
"common": "2.0.0",
"game": "2.0.0",

View File

@ -275,7 +275,7 @@ export default class AnalyseCtrl {
makeCgOpts(): ChessgroundConfig {
const node = this.node,
color = this.turnColor(),
emptyDests = {} as chessUtil.Dests,
emptyDests = {} as cg.Dests,
dests = chessUtil.readDests(this.node.dests),
drops = chessUtil.readDrops(this.node.drops),
movableColor = (this.practice || this.gamebookPlay()) ? this.bottomColor() : (

View File

@ -54,7 +54,7 @@ export function cancel(ctrl: AnalyseCtrl) {
function renderPromotion(ctrl: AnalyseCtrl, dest: Key, pieces: string[], color: Color, orientation: Color) {
if (!promoting) return;
let left = (8 - util.key2pos(dest)[0]) * 12.5;
let left = (7 - util.key2pos(dest)[0]) * 12.5;
if (orientation === 'white') left = 87.5 - left;
const vertical = color === orientation ? 'top' : 'bottom';

View File

@ -16,7 +16,7 @@
"@build/cssProject": "2.0.0"
},
"dependencies": {
"chessground": "^7.6",
"chessground": "^7.7.0",
"chessops": "^0.4.2",
"snabbdom": "ornicar/snabbdom#0.7.1-lichess",
"common": "2.0.0"

View File

@ -18,7 +18,7 @@
"@types/lichess": "2.0.0"
},
"dependencies": {
"chessground": "^7.6",
"chessground": "^7.7.0",
"common": "2.0.0",
"snabbdom": "ornicar/snabbdom#0.7.1-lichess"
}

View File

@ -98,15 +98,15 @@ export function renderPiecesOn(pieces: Pieces, rankOrFile: string, style: Style)
export function renderBoard(pieces: Pieces, pov: Color): string {
const board = [[' ', ...files, ' ']];
for(let rank of invRanks) {
for (let rank of invRanks) {
let line = [];
for(let file of files) {
for (let file of files) {
let key = file + rank;
const piece = pieces[key];
if (piece) {
const letter = letters[piece.role];
line.push(piece.color === 'white' ? letter.toUpperCase() : letter);
} else line.push((file.charCodeAt(0) + rank) % 2 ? '-' : '+');
} else line.push((key.charCodeAt(0) + key.charCodeAt(1)) % 2 ? '-' : '+');
}
board.push(['' + rank, ...line, '' + rank]);
}

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"ceval": "2.0.0",
"chessground": "^7.6",
"chessground": "^7.7.0",
"chessops": "^0.4.2",
"common": "2.0.0",
"snabbdom": "ornicar/snabbdom#0.7.1-lichess",

View File

@ -55,7 +55,7 @@ export default function(vm: Vm, getGround, redraw: Redraw): Promotion {
function renderPromotion(dest: Key, pieces: Role[], color: Color, orientation: Color): MaybeVNode {
if (!promoting) return;
let left = (8 - cgUtil.key2pos(dest)[0]) * 12.5;
let left = (7 - cgUtil.key2pos(dest)[0]) * 12.5;
if (orientation === 'white') left = 87.5 - left;
const vertical = color === orientation ? 'top' : 'bottom';

View File

@ -18,7 +18,7 @@
},
"dependencies": {
"chat": "2.0.0",
"chessground": "^7.6",
"chessground": "^7.7.0",
"common": "2.0.0",
"game": "2.0.0",
"nvui": "2.0.0",

View File

@ -6,10 +6,10 @@ export function capture(ctrl: RoundController, key: cg.Key) {
const exploding: cg.Key[] = [],
diff: cg.PiecesDiff = {},
orig = util.key2pos(key),
minX = Math.max(1, orig[0] - 1),
maxX = Math.min(8, orig[0] + 1),
minY = Math.max(1, orig[1] - 1),
maxY = Math.min(8, orig[1] + 1);
minX = Math.max(0, orig[0] - 1),
maxX = Math.min(7, orig[0] + 1),
minY = Math.max(0, orig[1] - 1),
maxY = Math.min(7, orig[1] + 1);
const pieces = ctrl.chessground.state.pieces;
for (let x = minX; x <= maxX; x++) {

View File

@ -88,7 +88,7 @@ export function cancel(ctrl: RoundController) {
}
function renderPromotion(ctrl: RoundController, dest: cg.Key, roles: cg.Role[], color: Color, orientation: Color) {
var left = (8 - key2pos(dest)[0]) * 12.5;
var left = (7 - key2pos(dest)[0]) * 12.5;
if (orientation === 'white') left = 87.5 - left;
var vertical = color === orientation ? 'top' : 'bottom';

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"chat": "2.0.0",
"chessground": "^7.6",
"chessground": "^7.7.0",
"common": "2.0.0",
"game": "2.0.0",
"snabbdom": "ornicar/snabbdom#0.7.1-lichess"

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"chat": "2.0.0",
"chessground": "^7.6",
"chessground": "^7.7.0",
"common": "2.0.0",
"game": "2.0.0",
"snabbdom": "ornicar/snabbdom#0.7.1-lichess"

View File

@ -816,10 +816,10 @@ chessground@^4.4:
merge "1.2.0"
mithril "github:ornicar/mithril.js#v1.0.1"
chessground@^7.6:
version "7.6.14"
resolved "https://registry.yarnpkg.com/chessground/-/chessground-7.6.14.tgz#818d6cde93dadd76c53c962342f46306b38efa1b"
integrity sha512-BMH6uIdHAz0aygkjXfpTxppHuhnVIuef+PUUkr8o07husQ/WkGJKuHvpW8ljYtKLXIanG9P4S2HGM/R4CzMQ7A==
chessground@^7.7.0:
version "7.7.0"
resolved "https://registry.yarnpkg.com/chessground/-/chessground-7.7.0.tgz#55c7a205d3f3413ebefea89d0d436a4a5fd6c11c"
integrity sha512-NA5L6fRQ6DMGNc8I201JIE/I2vfS/d9iJKOgPijrq/mvD0nYDOYgvxNGHv6VqwBLUx5e/OKJcVRdZ3yDeCAoMQ==
chessops@^0.4.2:
version "0.4.2"