feat(pcb): 전해 콘덴서 + 쪽에 빗금 표시

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-04 13:52:55 +09:00
1 parent 0cfef03824
commit be505cb610
1 file changed
+6 -1
+6 -1
View File
@@ -341,7 +341,12 @@ function draw(){
ctx.strokeStyle=isSel?'#fff176':'rgba(255,255,255,.55)'; ctx.lineWidth=isSel?2:1;
const cf=FPM[part.fp]&&FPM[part.fp].circle;
if(cf){const cc=rotPoint(cf.cx,cf.cy,part.rot);ctx.beginPath();ctx.arc(sx(part.x+cc[0]),sy(part.y+cc[1]),cf.r*view.s,0,7);ctx.stroke();
if(/^kicad:Capacitor_THT:CP_/.test(part.fp)){const p1=padsOf(part).find(q=>q.id.endsWith('-1'));if(p1){const dx=p1.x-(part.x+cc[0]),dy=p1.y-(part.y+cc[1]),L=Math.hypot(dx,dy)||1;ctx.fillStyle=ctx.strokeStyle;ctx.font='bold 13px sans-serif';ctx.textAlign='center';ctx.fillText('+',sx(part.x+cc[0]+dx/L*cf.r*1.25),sy(part.y+cc[1]+dy/L*cf.r*1.25)+4);ctx.textAlign='left';}}}
if(/^kicad:Capacitor_THT:CP_/.test(part.fp)){const p1=padsOf(part).find(q=>q.id.endsWith('-1'));if(p1){const dx=p1.x-(part.x+cc[0]),dy=p1.y-(part.y+cc[1]),L=Math.hypot(dx,dy)||1;const ux=dx/L,uy=dy/L,X0=sx(part.x+cc[0]),Y0=sy(part.y+cc[1]),R0=cf.r*view.s; // + 쪽 호(현 너머) 영역에 빗금
ctx.save();ctx.beginPath();ctx.arc(X0,Y0,R0,0,7);ctx.clip();ctx.beginPath();ctx.rect(-1e4,-1e4,2e4,2e4);ctx.moveTo(0,0); // 원으로 자름
ctx.beginPath();const t=R0*0.35,vx=-uy,vy=ux;ctx.moveTo(X0+ux*t+vx*R0*2,Y0+uy*t+vy*R0*2);ctx.lineTo(X0+ux*t-vx*R0*2,Y0+uy*t-vy*R0*2);ctx.lineTo(X0+ux*R0*2-vx*R0*2,Y0+uy*R0*2-vy*R0*2);ctx.lineTo(X0+ux*R0*2+vx*R0*2,Y0+uy*R0*2+vy*R0*2);ctx.closePath();ctx.clip();
ctx.lineWidth=1;const step=Math.max(4,0.55*view.s);for(let k=-R0*3;k<R0*3;k+=step){ctx.beginPath();ctx.moveTo(X0+k-R0*2,Y0+R0*2);ctx.lineTo(X0+k+R0*2,Y0-R0*2);ctx.stroke();}
ctx.restore();
ctx.fillStyle=ctx.strokeStyle;ctx.font='bold 13px sans-serif';ctx.textAlign='center';ctx.fillText('+',sx(part.x+cc[0]+dx/L*cf.r*1.25),sy(part.y+cc[1]+dy/L*cf.r*1.25)+4);ctx.textAlign='left';}}}
else ctx.strokeRect(sx(b.x0),sy(b.y0),(b.x1-b.x0)*view.s,(b.y1-b.y0)*view.s);
ctx.fillStyle=isSel?'#fff176':'rgba(255,255,255,.8)'; ctx.font='11px sans-serif'; ctx.fillText(part.ref+(part.value?' '+part.value:''),sx(b.x0)+2,sy(b.y0)-3);
for(const pad of padsOf(part)){