2026-11-01 00:41:38 -05:00
|
|
|
const resetCanvasState = () => {
|
|
|
|
|
resetRotation();
|
|
|
|
|
resetCanvasBrush();
|
|
|
|
|
clearCanvas();
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-01 01:37:33 -05:00
|
|
|
const resetRotation = () => { Painter.rotation = ROTATION; }
|
2026-11-01 00:41:38 -05:00
|
|
|
|
|
|
|
|
const resetCanvasBrush = () => {
|
|
|
|
|
setDefaultBrushSize();
|
|
|
|
|
setDefaultBrushColor();
|
|
|
|
|
setBrushToCenter();
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-01 01:37:33 -05:00
|
|
|
const clearCanvas = () => {
|
|
|
|
|
Painter.canvasContext.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
|
|
Painter.canvasContext.beginPath();
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-01 00:41:38 -05:00
|
|
|
const setDefaultBrushSize = () => {
|
|
|
|
|
Painter.brushSize = BRUSH_SIZE;
|
|
|
|
|
Painter.canvasContext.lineWidth = BRUSH_SIZE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const setDefaultBrushColor = () => {
|
|
|
|
|
Painter.brushColor = BRUSH_COLOR;
|
|
|
|
|
Painter.canvasContext.fillStyle = BRUSH_COLOR;
|
|
|
|
|
Painter.canvasContext.strokeStyle = BRUSH_COLOR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const setBrushToCenter = () => {
|
|
|
|
|
Painter.x1 = Painter.canvas.width / 2
|
|
|
|
|
Painter.y1 = Painter.canvas.height / 2
|
|
|
|
|
Painter.canvasContext.moveTo( Painter.x1, Painter.y1 );
|
|
|
|
|
}
|