fix analysis clock order

This commit is contained in:
Thibault Duplessis 2019-04-30 06:36:07 +07:00
parent 674f295063
commit c66b294dc7
2 changed files with 4 additions and 11 deletions

View file

@ -7,14 +7,7 @@ interface ClockOpts {
tenths: boolean;
}
export default function(ctrl: AnalyseCtrl): [VNode, VNode] | undefined {
const clocks = renderClocks(ctrl);
if (!clocks) return;
if (ctrl.bottomIsWhite()) clocks.reverse();
return clocks;
}
export function renderClocks(ctrl: AnalyseCtrl): [VNode, VNode] | undefined {
export default function renderClocks(ctrl: AnalyseCtrl): [VNode, VNode] | undefined {
const node = ctrl.node, clock = node.clock;
if (!clock && clock !== 0) return;
@ -38,8 +31,8 @@ export function renderClocks(ctrl: AnalyseCtrl): [VNode, VNode] | undefined {
};
return [
renderClock(centis[0], isWhiteTurn, whitePov ? 'top' : 'bottom', opts),
renderClock(centis[1], !isWhiteTurn, whitePov ? 'bottom' : 'top', opts)
renderClock(centis[0], isWhiteTurn, whitePov ? 'bottom' : 'top', opts),
renderClock(centis[1], !isWhiteTurn, whitePov ? 'top' : 'bottom', opts)
];
}

View file

@ -1,7 +1,7 @@
import { h } from 'snabbdom';
import { VNode } from 'snabbdom/vnode'
import { TagArray } from './interfaces';
import { renderClocks } from '../clocks';
import renderClocks from '../clocks';
import AnalyseCtrl from '../ctrl';
import { isFinished, findTag, resultOf } from './studyChapters';