This commit is contained in:
Maciej Caderek
2022-01-30 05:04:17 +01:00
parent a7c2d09c96
commit 3023329586
19 changed files with 4431 additions and 274 deletions

View File

@@ -1,5 +1,6 @@
import { BoardData, PieceType, PieceColor, PiecesStyle } from "../../types";
import ImagesCache from "../loaders/PiecesCache";
// import drawCircle from "./drawCircle";
const drawPieces = async (
ctx: CanvasRenderingContext2D,
@@ -35,12 +36,23 @@ const drawPieces = async (
);
}
if (color === check && type === "k") {
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px #ffa600)`);
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px #ffa600)`);
} else if (color === mate && type === "k") {
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px #ff002f)`);
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px #ff002f)`);
// if ((color === check || color === mate) && type === "k") {
// const hex = check ? "#ffa600" : "#ff002f";
// drawCircle(
// ctx,
// squareSize / 2,
// borderWidth + file * squareSize,
// borderWidth + rank * squareSize + margin,
// 0,
// hex,
// true
// );
// }
if ((color === check || color === mate) && type === "k") {
const hex = check ? "#ffa600" : "#ff002f";
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px ${hex})`);
filters.push(`drop-shadow(0 0 ${squareSize * 0.07}px ${hex})`);
}
ctx.filter = filters.length > 0 ? filters.join(" ") : "none";