fix: move arc center left, shorten line to 82% to prevent overflow

This commit is contained in:
2026-07-25 17:36:45 +08:00
parent 7eb1ef4b81
commit 7f529bcfc6
+2 -2
View File
@@ -63,7 +63,7 @@ const box=document.getElementById('box'),canvas=document.getElementById('rpm-can
const proto=location.protocol==='https:'?'wss:':'ws:',wsUrl=proto+'//'+location.host+'/ws'; const proto=location.protocol==='https:'?'wss:':'ws:',wsUrl=proto+'//'+location.host+'/ws';
const ctx=canvas.getContext('2d'); const ctx=canvas.getContext('2d');
let ws,rt,lR=-1,lG=-999; let ws,rt,lR=-1,lG=-999;
const Ca=320,Cb=420,Cr=280,As=180,Ae=270; const Ca=280,Cb=420,Cr=280,As=180,Ae=270;
function d2r(d){return d*Math.PI/180} function d2r(d){return d*Math.PI/180}
function pr(r){if(!r||r==='auto')return null;const p=r.split(':');if(p.length===2)return +p[0]/+p[1]} function pr(r){if(!r||r==='auto')return null;const p=r.split(':');if(p.length===2)return +p[0]/+p[1]}
@@ -90,7 +90,7 @@ function draw(cur,max){
ctx.clearRect(0,0,W,H); ctx.clearRect(0,0,W,H);
const sx=Ca/640*W,sy=Cb/480*H,sr=Cr/640*W; const sx=Ca/640*W,sy=Cb/480*H,sr=Cr/640*W;
const gw=Math.max(36,W/18); const gw=Math.max(36,W/18);
const ae=d2r(Ae),ex=sx+sr*Math.cos(ae),ey=sy+sr*Math.sin(ae),lx=W*.93; const ae=d2r(Ae),ex=sx+sr*Math.cos(ae),ey=sy+sr*Math.sin(ae),lx=W*.82;
const arcLen=Math.PI*2*sr*((Ae-As)/360),lineLen=lx-ex,totalLen=arcLen+lineLen; const arcLen=Math.PI*2*sr*((Ae-As)/360),lineLen=lx-ex,totalLen=arcLen+lineLen;
const rl=max*.85; const rl=max*.85;