Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
druid-widgets
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Miller
druid-widgets
Commits
e5eeb053
Commit
e5eeb053
authored
5 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
dail3 works
parent
777716c6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
examples/dial_test3.rs
+61
-0
61 additions, 0 deletions
examples/dial_test3.rs
with
62 additions
and
1 deletion
Cargo.toml
+
1
−
1
View file @
e5eeb053
[package]
[package]
name
=
"
envelop_edit
"
name
=
"
druid_widgets
"
version
=
"0.1.0"
version
=
"0.1.0"
authors
=
[
"Per Lindgren <per.lindgren@ltu.se>"
]
authors
=
[
"Per Lindgren <per.lindgren@ltu.se>"
]
edition
=
"2018"
edition
=
"2018"
...
...
This diff is collapsed.
Click to expand it.
examples/dial_test3.rs
0 → 100644
+
61
−
0
View file @
e5eeb053
// 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
(())
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment