This commit is contained in:
Maciej Caderek
2022-04-10 21:35:52 +02:00
parent 32c362b0d0
commit fc0746923c
25 changed files with 209 additions and 43 deletions

View File

@@ -83,6 +83,14 @@ class Board {
this.updateConfig(config, false);
}
async setCanvas(canvas: HTMLCanvasElement) {
this.canvas = canvas;
this.ctx = canvas.getContext("2d") as CanvasRenderingContext2D;
this.setSize(this.cfg.size);
await this.refresh();
}
async updateConfig(config: Partial<BoardConfig>, refresh: boolean = true) {
const cfg = { ...this.cfg, ...config };

View File

@@ -1,6 +1,7 @@
import { Header, Style } from "../../types";
import drawRectangle from "./drawRectangle";
import drawText from "./drawText";
import loadImage from "../loaders/loadImage";
const drawHeader = async (
ctx: CanvasRenderingContext2D,
@@ -84,6 +85,25 @@ const drawHeader = async (
fromTop += line;
});
const logo = await loadImage("/img/logo-full.svg");
const logoHeight = size * 0.114 * 0.5;
ctx.shadowColor = "rgba(0, 0, 0, 1)";
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
ctx.shadowBlur = 10 * scale;
ctx.drawImage(
logo,
size / 4,
margin + size + margin - logoHeight * 2,
size / 2,
logoHeight
);
ctx.shadowColor = "rgba(0, 0, 0, 0)";
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
};
export default drawHeader;

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#3cff0055",
data: "#ffaa0055",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#3cff0055",
data: "#00ffff55",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#3cff0055",
data: "#ffaa0055",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#00ffee55",
data: "#ffff0055",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#3cff0055",
data: "#ff00ff55",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#00ffee55",
data: "#00ffff55",
},
border: {
type: "gradient",

View File

@@ -24,7 +24,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#3cff0055",
data: "#ffaa0055",
},
border: {
type: "gradient",

View File

@@ -23,7 +23,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#ffff0055",
data: "#ff000044",
},
border: {
type: "solid",

View File

@@ -23,7 +23,7 @@ const style: Style = {
},
moveIndicator: {
type: "color",
data: "#ffff0055",
data: "#00ffff55",
},
border: {
type: "solid",