You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
465 B
Rust
16 lines
465 B
Rust
use std::f64;
|
|
use crate::shapes::*;
|
|
|
|
pub fn draw_circle(circle: Circle, context: &web_sys::CanvasRenderingContext2d) {
|
|
context.move_to(circle.center.x+circle.radius, circle.center.y);
|
|
context
|
|
.arc(circle.center.x, circle.center.y, circle.radius, 0.0, f64::consts::PI * 2.0)
|
|
.unwrap();
|
|
}
|
|
|
|
pub fn draw_line(line: Line, context: &web_sys::CanvasRenderingContext2d) {
|
|
context.move_to(line.p1.x, line.p1.y);
|
|
context
|
|
.line_to(line.p2.x, line.p2.y);
|
|
}
|