define the struct Point
parent
cc6a0c4bce
commit
45ad11a0db
@ -1,9 +1,15 @@
|
||||
use std::f64;
|
||||
|
||||
pub fn draw_circle(center: (f64, f64), radius: f64, context: &web_sys::CanvasRenderingContext2d) {
|
||||
let (x, y) = center;
|
||||
context.move_to(x+radius, y);
|
||||
context
|
||||
.arc(x, y, radius, 0.0, f64::consts::PI * 2.0)
|
||||
.unwrap();
|
||||
}
|
||||
pub struct Point(pub f64, pub f64);
|
||||
|
||||
pub fn draw_circle(center: Point, radius: f64, context: &web_sys::CanvasRenderingContext2d) {
|
||||
context.move_to(center.0+radius, center.1);
|
||||
context
|
||||
.arc(center.0, center.1, radius, 0.0, f64::consts::PI * 2.0)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn draw_line(p1: Point, p2: Point, context: &web_sys::CanvasRenderingContext2d) {
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue