Draw distinct lines
This commit is contained in:
parent
8d15e67882
commit
1dfac5728c
2 changed files with 16 additions and 16 deletions
|
@ -513,22 +513,22 @@ fn view_line_canvas(app: &App, model: &Model, frame: Frame) {
|
||||||
let thickness = 2.0;
|
let thickness = 2.0;
|
||||||
// let hz = ((app.mouse.x + win.right()) / win.w()).powi(4) * 1000.0;
|
// let hz = ((app.mouse.x + win.right()) / win.w()).powi(4) * 1000.0;
|
||||||
|
|
||||||
// TODO draw distinct lines, using euclid for scale
|
// TODO refactor to using euclid::point2D for scale
|
||||||
let points: LaserPoints = (&model.current_lines).into();
|
|
||||||
|
|
||||||
let vertices = points.iter().map(|p| {
|
for line in &model.current_lines.lines{
|
||||||
let color = srgba(p.color[0], p.color[1], p.color[2], 1.0);
|
let vertices = line.points.iter().map(|p| {
|
||||||
|
let color = srgba(p.color.red, p.color.green, p.color.blue, p.color.alpha);
|
||||||
|
|
||||||
let pos = [p.position[0] * scale, p.position[1] * -scale];
|
let pos = [p.position[0] * scale, p.position[1] * -scale];
|
||||||
(pos, color)
|
(pos, color)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Draw the polyline as a stroked path.
|
|
||||||
draw.polyline()
|
draw.polyline()
|
||||||
.weight(thickness)
|
.weight(thickness)
|
||||||
.join_round()
|
.join_round()
|
||||||
.points_colored(vertices);
|
.points_colored(vertices);
|
||||||
// model.current_points
|
}
|
||||||
|
|
||||||
|
|
||||||
// put everything on the frame
|
// put everything on the frame
|
||||||
draw.to_frame(app, &frame).unwrap();
|
draw.to_frame(app, &frame).unwrap();
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub struct RenderablePoint{
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct RenderableLine{
|
pub struct RenderableLine{
|
||||||
points: Vec<RenderablePoint>
|
pub points: Vec<RenderablePoint>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
|
Loading…
Reference in a new issue