WIP
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user