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 hz = ((app.mouse.x + win.right()) / win.w()).powi(4) * 1000.0;
|
||||
|
||||
// TODO draw distinct lines, using euclid for scale
|
||||
let points: LaserPoints = (&model.current_lines).into();
|
||||
// TODO refactor to using euclid::point2D for scale
|
||||
|
||||
let vertices = points.iter().map(|p| {
|
||||
let color = srgba(p.color[0], p.color[1], p.color[2], 1.0);
|
||||
for line in &model.current_lines.lines{
|
||||
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];
|
||||
(pos, color)
|
||||
});
|
||||
let pos = [p.position[0] * scale, p.position[1] * -scale];
|
||||
(pos, color)
|
||||
});
|
||||
|
||||
draw.polyline()
|
||||
.weight(thickness)
|
||||
.join_round()
|
||||
.points_colored(vertices);
|
||||
}
|
||||
|
||||
// Draw the polyline as a stroked path.
|
||||
draw.polyline()
|
||||
.weight(thickness)
|
||||
.join_round()
|
||||
.points_colored(vertices);
|
||||
// model.current_points
|
||||
|
||||
// put everything on the frame
|
||||
draw.to_frame(app, &frame).unwrap();
|
||||
|
|
|
@ -49,7 +49,7 @@ pub struct RenderablePoint{
|
|||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct RenderableLine{
|
||||
points: Vec<RenderablePoint>
|
||||
pub points: Vec<RenderablePoint>
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
|
|
Loading…
Reference in a new issue