Skip to content

Commit

Permalink
Fix game play regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Nov 3, 2019
1 parent 794ddf6 commit 7e0496b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
10 changes: 7 additions & 3 deletions src/movelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Color } from 'chessgroundx/types';

import { gearButton, toggleOrientation } from './settings';
import RoundController from './roundCtrl';
import AnalysisController from './analysisCtrl';


interface Eval {
Expand Down Expand Up @@ -71,9 +72,12 @@ export function selectMove (ctrl, ply) {
}
ctrl.goPly(ply)
scrollToPly(ctrl);
const hc = ctrl.analysisChart;
const hcPt = hc.series[0].data[ply];
hcPt.select();

if (ctrl instanceof AnalysisController) {
const hc = ctrl.analysisChart;
const hcPt = hc.series[0].data[ply];
hcPt.select();
}
}

function scrollToPly (ctrl) {
Expand Down
4 changes: 2 additions & 2 deletions src/roundCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ export default class RoundController {
}

private gameOver = () => {
var container = document.getElementById('moves') as HTMLElement;
var container = document.getElementById('movelist') as HTMLElement;
var movesTail: VNode[] = [];
if (this.turnColor === 'black') movesTail.push(h('li.move.hidden', 'X'));
movesTail.push(h('div#result', result(this.status, this.result)));
patch(container, h('div#moves', movesTail));
patch(container, h('ol.movelist#movelist', movesTail));

if (!this.spectator) {
this.gameControls = patch(this.gameControls, h('div'));
Expand Down
5 changes: 4 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { pocketView } from './pocket';
import { needPockets } from './chess';
import { player } from './player';
import { analysisChart } from './chart';
import AnalysisController from './analysisCtrl';

// TODO: add dark/light theme buttons (icon-sun-o/icon-moon-o)

Expand Down Expand Up @@ -102,8 +103,10 @@ function setZoom (ctrl, zoom: number) {

document.body.dispatchEvent(new Event('chessground.resize'));
localStorage.setItem("zoom-" + ctrl.variant, String(zoom));
analysisChart(ctrl);

if (ctrl instanceof AnalysisController) {
analysisChart(ctrl);
}
}
}

Expand Down
24 changes: 15 additions & 9 deletions static/pychess-variants.js

Large diffs are not rendered by default.

0 comments on commit 7e0496b

Please sign in to comment.