MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / zone

Function zone

app/rcc/scripts/painter/dial_gauge.js:66–76  ·  view source on GitHub ↗
(v0, v1, color)

Source from the content-addressed store, hash-verified

64
65 // Coloured zones along the arc.
66 function zone(v0, v1, color) {
67 const t0 = startA + sweep * ((v0 - lo) / span);
68 const t1 = startA + sweep * ((v1 - lo) / span);
69 ctx.beginPath();
70 ctx.moveTo(cx + Math.cos(t0) * r, cy + Math.sin(t0) * r);
71 ctx.arc(cx, cy, r, t0, t1);
72 ctx.lineWidth = 14;
73 ctx.lineCap = "butt";
74 ctx.strokeStyle = color;
75 ctx.stroke();
76 }
77 zone(lo, lo + span * 0.60, theme.widget_highlight);
78 zone(lo + span * 0.60, lo + span * 0.85, theme.accent);
79 zone(lo + span * 0.85, hi, theme.alarm);

Callers 1

paintFunction · 0.85

Calls 4

beginPathMethod · 0.80
moveToMethod · 0.80
arcMethod · 0.80
strokeMethod · 0.80

Tested by

no test coverage detected