This commit is contained in:
Maciej Caderek
2022-01-20 06:45:14 +01:00
parent 918a5dff4f
commit 8733c1c3ab
18 changed files with 308 additions and 226 deletions

View File

@@ -8,10 +8,10 @@ const drawPieces = async (
borderWidth: number,
tiles: number,
flipped: boolean,
check?: "b" | "w",
mate?: "b" | "w",
shadow: boolean = false,
blur: boolean = false
check: "b" | "w" | undefined,
mate: "b" | "w" | undefined,
shadow: boolean,
margin: number
) => {
for (let y = 0; y < 8; y++) {
for (let x = 0; x < 8; x++) {
@@ -26,10 +26,6 @@ const drawPieces = async (
const filters = [];
if (blur) {
filters.push(`blur(5px)`);
}
if (shadow) {
filters.push(
`drop-shadow(${squareSize * 0.05}px ${squareSize * 0.05}px ${
@@ -51,7 +47,7 @@ const drawPieces = async (
ctx.drawImage(
img,
borderWidth + file * squareSize,
borderWidth + rank * squareSize,
borderWidth + rank * squareSize + margin,
squareSize,
squareSize
);