This commit is contained in:
Maciej Caderek
2022-02-10 01:14:20 +01:00
parent 20f415d70c
commit e93ac083fa
9 changed files with 176 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
import { BoardConfig, PiecesStyle, Position } from "./../types";
import { Style } from "../types";
import { Style, BoardStyle } from "../types";
import drawRectangle from "./layers/drawRectangle";
import drawCoords from "./layers/drawCoords";
import drawMoveIndicators from "./layers/drawMoveIndicators";
@@ -11,7 +11,7 @@ import boards from "./styles-board";
const defaultConfig: BoardConfig = {
size: 720,
tiles: 8,
boardStyle: boards.avocado,
boardStyle: "avocado",
piecesStyle: "gioco",
showBorder: true,
showExtraInfo: true,
@@ -135,8 +135,8 @@ class Board {
return this.size;
}
setStyle(style: Style) {
this.style = style;
setStyle(style: BoardStyle) {
this.style = boards[style];
return this;
}
@@ -195,6 +195,8 @@ class Board {
canvas.width = this.size;
canvas.height = this.size + this.margin * 2;
console.log({ style: this.style });
const { background, dark, light, border, coords } = this.style;
await drawRectangle(ctx, this.width, this.height, 0, 0, border);