MCPcopy Create free account
hub / github.com/angular-rust/ux-charts / draw

Method draw

src/radar.rs:40–56  ·  view source on GitHub ↗
(&self, ctx: &C, percent: f64, highlight: bool)

Source from the content-addressed store, hash-verified

38 C: CanvasContext<Pattern>,
39{
40 fn draw(&self, ctx: &C, percent: f64, highlight: bool) {
41 let r = lerp(self.old_radius, self.radius, percent);
42 let a = lerp(self.old_angle, self.angle, percent);
43 let pr = lerp(self.old_point_radius, self.point_radius, percent);
44 let p = utils::polar2cartesian(&self.center, r, a);
45 if highlight {
46 ctx.set_fill_color(self.highlight_color);
47 ctx.begin_path();
48 ctx.arc(p.x, p.y, 2. * pr, 0., TAU, false);
49 ctx.fill();
50 }
51 ctx.set_fill_color(self.color);
52 ctx.begin_path();
53 ctx.arc(p.x, p.y, pr, 0., TAU, false);
54 ctx.fill();
55 ctx.stroke();
56 }
57}
58
59impl<D> Entity for PolarPoint<D> {

Callers 1

draw_channelsMethod · 0.45

Calls 6

polar2cartesianFunction · 0.85
disposeMethod · 0.80
update_channelMethod · 0.45
draw_frameMethod · 0.45

Tested by

no test coverage detected