add 'draw_line' method
This commit is contained in:
parent
45ad11a0db
commit
59cd9727a8
2 changed files with 6 additions and 2 deletions
|
@ -9,7 +9,8 @@ pub fn draw_circle(center: Point, radius: f64, context: &web_sys::CanvasRenderin
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn draw_line(p1: Point, p2: Point, context: &web_sys::CanvasRenderingContext2d) {
|
||||
context.move_to(p1.0, p1.1);
|
||||
context
|
||||
.line_to(p2.0, p2.1);
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -25,5 +25,8 @@ pub fn start() {
|
|||
drawing::draw_circle(Point(75.0, 75.0), 35.0, &context);
|
||||
drawing::draw_circle(Point(60.0, 65.0), 5.0, &context);
|
||||
|
||||
drawing::draw_line(Point(0.0, 0.0), Point(150.0, 150.0), &context);
|
||||
drawing::draw_line(Point(0.0, 150.0), Point(150.0, 0.0), &context);
|
||||
|
||||
context.stroke();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue