re-add the tick marks
This commit is contained in:
parent
28192ff8d7
commit
6fb7749642
|
@ -55,7 +55,7 @@ impl PieChart {
|
||||||
|
|
||||||
pub fn draw(self, context: &Context) {
|
pub fn draw(self, context: &Context) {
|
||||||
println!("drawing: {} {}", self.width, self.height);
|
println!("drawing: {} {}", self.width, self.height);
|
||||||
let radius = self.width.min(self.height) as f64 / 2. * 0.9;
|
let radius = self.width.min(self.height) as f64 / 2.;
|
||||||
let center_x = (self.width / 2) as f64;
|
let center_x = (self.width / 2) as f64;
|
||||||
let center_y = (self.height / 2) as f64;
|
let center_y = (self.height / 2) as f64;
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ impl TransitClock {
|
||||||
move |_, context, width, height| {
|
move |_, context, width, height| {
|
||||||
let center_x = width as f64 / 2.;
|
let center_x = width as f64 / 2.;
|
||||||
let center_y = height as f64 / 2.;
|
let center_y = height as f64 / 2.;
|
||||||
let radius = width.min(height) as f64 / 2.;
|
let radius = width.min(height) as f64 / 2. * 0.9;
|
||||||
if let Some(ref info) = *s.imp().info.borrow() {
|
if let Some(ref info) = *s.imp().info.borrow() {
|
||||||
let full_day = Duration::days(1).num_seconds() as f64;
|
let full_day = Duration::days(1).num_seconds() as f64;
|
||||||
let sunrise = info.sunrise - NaiveTime::from_hms_opt(0, 0, 0).unwrap();
|
let sunrise = info.sunrise - NaiveTime::from_hms_opt(0, 0, 0).unwrap();
|
||||||
|
@ -280,8 +280,8 @@ impl TransitClock {
|
||||||
context.set_source_rgb(0., 0., 0.);
|
context.set_source_rgb(0., 0., 0.);
|
||||||
context.translate(center_x, center_y);
|
context.translate(center_x, center_y);
|
||||||
context.rotate(tick as f64 * (PI / 12.));
|
context.rotate(tick as f64 * (PI / 12.));
|
||||||
context.move_to(center_x, center_y);
|
context.move_to(radius, 0.);
|
||||||
context.line_to(center_x + 10., center_y);
|
context.line_to(radius - 10., 0.);
|
||||||
let _ = context.stroke();
|
let _ = context.stroke();
|
||||||
context.identity_matrix();
|
context.identity_matrix();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue