Whiteboard: Radierer-Fix (destination-out → Hintergrundfarbe), Icon 🧹

This commit is contained in:
2026-06-25 21:15:39 +02:00
parent 267c149eec
commit da27a2f5ce

View File

@@ -11,7 +11,7 @@ const TOOLS = [
{ id:'rect', label:'▭', tip:'Rechteck' }, { id:'rect', label:'▭', tip:'Rechteck' },
{ id:'ellipse', label:'◯', tip:'Ellipse' }, { id:'ellipse', label:'◯', tip:'Ellipse' },
{ id:'text', label:'T', tip:'Text' }, { id:'text', label:'T', tip:'Text' },
{ id:'eraser', label:'', tip:'Radierer' }, { id:'eraser', label:'🧹', tip:'Radierer' },
]; ];
const CURSOR_COLORS = ['#FF6B9D','#4ECDC4','#FFE66D','#60A5FA','#A78BFA','#FB923C']; const CURSOR_COLORS = ['#FF6B9D','#4ECDC4','#FFE66D','#60A5FA','#A78BFA','#FB923C'];
@@ -143,8 +143,10 @@ function renderElements(ctx, elements, vp) {
case 'eraser': { case 'eraser': {
if (!el.points?.length) break; if (!el.points?.length) break;
ctx.save(); ctx.save();
ctx.globalCompositeOperation = 'destination-out'; ctx.strokeStyle = '#0D0D0F'; // Hintergrundfarbe des Canvas
ctx.lineWidth = (el.size || 20) / vp.zoom; ctx.lineWidth = (el.size || 4) * 3 / vp.zoom; // Radierer ist 3× breiter als Stift
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(el.points[0].x, el.points[0].y); ctx.moveTo(el.points[0].x, el.points[0].y);
for (const p of el.points.slice(1)) ctx.lineTo(p.x, p.y); for (const p of el.points.slice(1)) ctx.lineTo(p.x, p.y);