fix: arc scale marks use same path-distance angle as progress

This commit is contained in:
2026-07-25 17:46:32 +08:00
parent 20fd2964b2
commit f2f9565436
+4 -4
View File
@@ -133,15 +133,15 @@ function draw(cur,max){
// scale marks along TOTAL path (arc + line)
const mr=sr-gw/2-6,pr=sr+gw/2+6;
for(let r=0;r<=max;r+=2000){
const t=r/max,p=pathPt(t);
if(r*totalLen/max<=arcLen){
const a=d2r(As+(Ae-As)*t);
const t=r/max,ad=t*totalLen;
if(ad<=arcLen){
const a=d2r(As+(Ae-As)*(ad/arcLen));
ctx.beginPath();ctx.moveTo(sx+mr*Math.cos(a),sy+mr*Math.sin(a));ctx.lineTo(sx+pr*Math.cos(a),sy+pr*Math.sin(a));
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();
if(r%4000===0){ctx.fillStyle='rgba(255,255,255,.22)';ctx.font=`${Math.max(13,W/38)|0}px 'NEXT ART',sans-serif`;ctx.textAlign='center';ctx.fillText(Math.round(r/1000),sx+(pr+22)*Math.cos(a),sy+(pr+22)*Math.sin(a)+5)}
}else{
// on line portion: vertical marks
const p=pathPt(t);
ctx.beginPath();ctx.moveTo(p.x,ey-gw/2-4);ctx.lineTo(p.x,ey+gw/2+4);
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();