From e161728fcff27539a1e77a5aca5d147a1364f935 Mon Sep 17 00:00:00 2001 From: Per Lindgren <per.lindgren@ltu.se> Date: Sun, 26 Jan 2020 20:14:37 +0100 Subject: [PATCH] ADSR with a viev (polish) --- examples/draw.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/examples/draw.rs b/examples/draw.rs index 4dc0174..f6e8d6f 100644 --- a/examples/draw.rs +++ b/examples/draw.rs @@ -14,14 +14,11 @@ //! An example of an animating widget. -use std::f64::consts::PI; - -use druid::kurbo::{BezPath, Line}; +use druid::kurbo::BezPath; use druid::widget::{Flex, Label, WidgetExt}; use druid::{ - AppLauncher, BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, Lens, - LinearGradient, PaintCtx, PlatformError, Point, RenderContext, Size, UnitPoint, UpdateCtx, - Vec2, WheelEvent, Widget, WindowDesc, + AppLauncher, BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, Lens, PaintCtx, + PlatformError, Point, RenderContext, Size, UpdateCtx, Widget, WindowDesc, }; use druid_widgets::Dial; @@ -106,9 +103,8 @@ impl Widget<Envelope> for Draw { ctx: &mut UpdateCtx, _old_data: Option<&Envelope>, _data: &Envelope, - env: &Env, + _env: &Env, ) { - //info!("update {:?}", env.get()); ctx.invalidate(); } @@ -119,7 +115,7 @@ impl Widget<Envelope> for Draw { _data: &Envelope, _env: &Env, ) -> Size { - bc.constrain((100.0, 100.0)) + bc.constrain((100.0, 100.0)) // this is probably incorrect } fn paint(&mut self, paint_ctx: &mut PaintCtx, data: &Envelope, _env: &Env) { @@ -159,17 +155,6 @@ impl Widget<Envelope> for Draw { }); paint_ctx.stroke(path, &Color::WHITE, 1.0); - - // if let Some(p) = self.points.iter().next() { - // let mut path = BezPath::new(); - // path.move_to(*p); - - // for p in self.points.iter() { - // path.line_to(*p); - // } - - // paint_ctx.stroke(path, &Color::WHITE, 1.0); - // } } } -- GitLab