Skip to content
Snippets Groups Projects
Commit e161728f authored by Per Lindgren's avatar Per Lindgren
Browse files

ADSR with a viev (polish)

parent 2bfe65b9
No related branches found
No related tags found
No related merge requests found
...@@ -14,14 +14,11 @@ ...@@ -14,14 +14,11 @@
//! An example of an animating widget. //! An example of an animating widget.
use std::f64::consts::PI; use druid::kurbo::BezPath;
use druid::kurbo::{BezPath, Line};
use druid::widget::{Flex, Label, WidgetExt}; use druid::widget::{Flex, Label, WidgetExt};
use druid::{ use druid::{
AppLauncher, BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, Lens, AppLauncher, BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, Lens, PaintCtx,
LinearGradient, PaintCtx, PlatformError, Point, RenderContext, Size, UnitPoint, UpdateCtx, PlatformError, Point, RenderContext, Size, UpdateCtx, Widget, WindowDesc,
Vec2, WheelEvent, Widget, WindowDesc,
}; };
use druid_widgets::Dial; use druid_widgets::Dial;
...@@ -106,9 +103,8 @@ impl Widget<Envelope> for Draw { ...@@ -106,9 +103,8 @@ impl Widget<Envelope> for Draw {
ctx: &mut UpdateCtx, ctx: &mut UpdateCtx,
_old_data: Option<&Envelope>, _old_data: Option<&Envelope>,
_data: &Envelope, _data: &Envelope,
env: &Env, _env: &Env,
) { ) {
//info!("update {:?}", env.get());
ctx.invalidate(); ctx.invalidate();
} }
...@@ -119,7 +115,7 @@ impl Widget<Envelope> for Draw { ...@@ -119,7 +115,7 @@ impl Widget<Envelope> for Draw {
_data: &Envelope, _data: &Envelope,
_env: &Env, _env: &Env,
) -> Size { ) -> 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) { fn paint(&mut self, paint_ctx: &mut PaintCtx, data: &Envelope, _env: &Env) {
...@@ -159,17 +155,6 @@ impl Widget<Envelope> for Draw { ...@@ -159,17 +155,6 @@ impl Widget<Envelope> for Draw {
}); });
paint_ctx.stroke(path, &Color::WHITE, 1.0); 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);
// }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment