From e5eeb053cd7210cf54637d7b99863d6db311f907 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Sun, 26 Jan 2020 03:16:15 +0100
Subject: [PATCH] dail3 works

---
 Cargo.toml             |  2 +-
 examples/dial_test3.rs | 61 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 examples/dial_test3.rs

diff --git a/Cargo.toml b/Cargo.toml
index d896626..2fb210f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "envelop_edit"
+name = "druid_widgets"
 version = "0.1.0"
 authors = ["Per Lindgren <per.lindgren@ltu.se>"]
 edition = "2018"
diff --git a/examples/dial_test3.rs b/examples/dial_test3.rs
new file mode 100644
index 0000000..a96a6b3
--- /dev/null
+++ b/examples/dial_test3.rs
@@ -0,0 +1,61 @@
+// Copyright 2019 The xi-editor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! An example of an animating widget.
+
+use std::f64::consts::PI;
+
+use druid::kurbo::{BezPath, Line};
+use druid::widget::{Flex, Label, Padding, WidgetExt};
+use druid::{
+    AppLauncher, BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, Lens, LensWrap,
+    LinearGradient, PaintCtx, PlatformError, Point, RenderContext, Size, UnitPoint, UpdateCtx,
+    Vec2, WheelEvent, Widget, WindowDesc,
+};
+
+use log::info;
+
+use druid_widgets::*;
+
+#[derive(Clone, Data, Lens)]
+struct DialLabel {
+    value: f64,
+}
+
+impl DialLabel {
+    fn new(text: String) -> impl Widget<DialLabel> {
+        let solid = Color::rgb8(0x3a, 0x3a, 0x3a);
+
+        let label =
+            Label::new(move |data: &DialLabel, _env: &_| format!("{} {:.3}", text, data.value));
+        let mut col = Flex::column();
+        col.add_child(
+            Dial::new(Size::new(100.0, 100.0))
+                .lens(DialLabel::value)
+                .background(solid.clone())
+                .padding(5.0),
+            0.0,
+        );
+        col.add_child(label.padding(5.0).background(solid.clone()), 1.0);
+        col
+    }
+}
+
+fn main() -> Result<(), PlatformError> {
+    AppLauncher::with_window(WindowDesc::new(|| DialLabel::new("Value".to_string())))
+        .use_simple_logger()
+        .launch(DialLabel { value: 0.0 })?;
+
+    Ok(())
+}
-- 
GitLab