From 21db91d0f5fdea629302cbde881cbafb1e68fd18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 06:44:20 +0000 Subject: [PATCH 1/2] Initial plan From 27d6d236318f9159a548e4f8f259231829d01562 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 06:51:45 +0000 Subject: [PATCH 2/2] Fix eraser tool to properly erase instead of painting white Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com> --- web/templates/whiteboard.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/web/templates/whiteboard.html b/web/templates/whiteboard.html index e2380d29c..2154ae4cf 100644 --- a/web/templates/whiteboard.html +++ b/web/templates/whiteboard.html @@ -86,10 +86,16 @@

Advanced Whiteboard

toolSelect.addEventListener('change', function() { currentTool = this.value; if (currentTool === 'pen') { + ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 1.0; } else if (currentTool === 'highlighter') { + ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 0.3; + } else if (currentTool === 'eraser') { + ctx.globalCompositeOperation = 'destination-out'; + ctx.globalAlpha = 1.0; } else { + ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 1.0; } }); @@ -213,12 +219,14 @@

Advanced Whiteboard

if (currentTool === 'pen' || currentTool === 'eraser' || currentTool === 'highlighter') { if (currentTool === 'eraser') { - ctx.strokeStyle = "#FFFFFF"; + ctx.globalCompositeOperation = 'destination-out'; ctx.globalAlpha = 1.0; } else if (currentTool === 'pen') { + ctx.globalCompositeOperation = 'source-over'; ctx.strokeStyle = penColor; ctx.globalAlpha = 1.0; } else if (currentTool === 'highlighter') { + ctx.globalCompositeOperation = 'source-over'; ctx.strokeStyle = penColor; ctx.globalAlpha = 0.3; } @@ -227,6 +235,7 @@

Advanced Whiteboard

ctx.stroke(); } else if (currentTool === 'line' || currentTool === 'rectangle' || currentTool === 'circle' || currentTool === 'arrow') { restoreSnapshot(); + ctx.globalCompositeOperation = 'source-over'; ctx.lineWidth = penWidth; ctx.strokeStyle = penColor; @@ -261,23 +270,27 @@

Advanced Whiteboard

if (currentTool === 'line') { restoreSnapshot(); + ctx.globalCompositeOperation = 'source-over'; ctx.beginPath(); ctx.moveTo(startX, startY); ctx.lineTo(currentX, currentY); ctx.stroke(); } else if (currentTool === 'rectangle') { restoreSnapshot(); + ctx.globalCompositeOperation = 'source-over'; const width = currentX - startX; const height = currentY - startY; ctx.strokeRect(startX, startY, width, height); } else if (currentTool === 'circle') { restoreSnapshot(); + ctx.globalCompositeOperation = 'source-over'; const radius = Math.sqrt(Math.pow(currentX - startX, 2) + Math.pow(currentY - startY, 2)); ctx.beginPath(); ctx.arc(startX, startY, radius, 0, Math.PI * 2); ctx.stroke(); } else if (currentTool === 'arrow') { restoreSnapshot(); + ctx.globalCompositeOperation = 'source-over'; drawArrow(startX, startY, currentX, currentY); } });