Refactor canvas and mask handling for clarity and maintainability

Removed redundant comments and streamlined logic across canvas-related modules, including mask positioning, garbage collection, and WebSocket communication. Improved code readability and maintainability by eliminating unnecessary explanations and clarifying intent in both Python and JavaScript files. No functional changes were made; this is a cleanup and refactor for better developer experience.
This commit is contained in:
Dariusz L
2025-06-27 06:17:24 +02:00
parent 711722eb9f
commit b40d645a79
9 changed files with 104 additions and 182 deletions

View File

@@ -83,10 +83,9 @@ export class CanvasRenderer {
this.drawCanvasOutline(ctx);
const maskImage = this.canvas.maskTool.getMask();
if (maskImage) {
// Create a clipping region to only show mask content that overlaps with the output area
ctx.save();
// Only show what's visible inside the output area
if (this.canvas.maskTool.isActive) {
ctx.globalCompositeOperation = 'source-over';
ctx.globalAlpha = 0.5;
@@ -94,8 +93,7 @@ export class CanvasRenderer {
ctx.globalCompositeOperation = 'source-over';
ctx.globalAlpha = 1.0;
}
// Draw the mask at its world space position
ctx.drawImage(maskImage, this.canvas.maskTool.x, this.canvas.maskTool.y);
ctx.globalAlpha = 1.0;