Merge branch 'master' of /home/thib/lila into lila3

* 'master' of /home/thib/lila:
  Added 'Clear board' button (#5742)
This commit is contained in:
Thibault Duplessis 2019-12-12 09:41:25 -06:00
commit 848236b2b9
2 changed files with 10 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import { SquareSet } from 'chessops/squareSet';
import { Board } from 'chessops/board';
import { Setup, Material, RemainingChecks } from 'chessops/setup';
import { Castles, setupPosition } from 'chessops/variant';
import { makeFen, parseFen, parseCastlingFen, INITIAL_FEN, EMPTY_FEN, INITIAL_EPD, EMPTY_EPD } from 'chessops/fen';
import { makeFen, parseFen, parseCastlingFen, INITIAL_FEN, EMPTY_FEN, INITIAL_EPD } from 'chessops/fen';
import { defined, prop, Prop } from 'common';
export default class EditorCtrl {
@ -40,10 +40,6 @@ export default class EditorCtrl {
fen: INITIAL_FEN,
epd: INITIAL_EPD,
name: this.trans('startPosition')
}, {
fen: EMPTY_FEN,
epd: EMPTY_EPD,
name: this.trans('clearBoard')
}, {
fen: 'prompt',
name: this.trans('loadPosition')

View file

@ -4,7 +4,7 @@ import { MouchEvent, NumberPair } from 'chessground/types';
import { dragNewPiece } from 'chessground/drag';
import { eventPosition, opposite } from 'chessground/util';
import { Rules } from 'chessops/types';
import { parseFen } from 'chessops/fen';
import { parseFen, EMPTY_FEN } from 'chessops/fen';
import EditorCtrl from './ctrl';
import chessground from './chessground';
import { OpeningPosition, Selected, CastlingToggle, EditorState } from './interfaces';
@ -165,6 +165,14 @@ function controls(ctrl: EditorCtrl, state: EditorState): VNode {
}, allVariants.map(x => variant2option(x[0], x[1], ctrl)))
]),
h('div.actions', [
h('a.button.button-empty.text', {
attrs: { 'data-icon': 'q' },
on: {
click() {
ctrl.setFen(EMPTY_FEN);
}
}
}, ctrl.trans.noarg('clearBoard')),
h('a.button.button-empty.text', {
attrs: { 'data-icon': 'B' },
on: {