summaryrefslogtreecommitdiffstats
path: root/examples/bezier_tool
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-29 22:28:31 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-29 22:28:31 +0100
commite09b4e24dda51b8212d8ece52431dacaa3922a7b (patch)
tree7005e181528134ebdde5bbbe5909273db9f30174 /examples/bezier_tool
parent83c7870c569a2976923ee6243a19813094d44673 (diff)
parent7f8b17604a31e00becc43130ec516c1a53552c88 (diff)
downloadiced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.tar.gz
iced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.tar.bz2
iced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.zip
Merge branch 'master' into feat/multi-window-support
Diffstat (limited to 'examples/bezier_tool')
-rw-r--r--examples/bezier_tool/Cargo.toml3
-rw-r--r--examples/bezier_tool/README.md4
-rw-r--r--examples/bezier_tool/src/main.rs11
3 files changed, 7 insertions, 11 deletions
diff --git a/examples/bezier_tool/Cargo.toml b/examples/bezier_tool/Cargo.toml
index 890e3027..b2547ff1 100644
--- a/examples/bezier_tool/Cargo.toml
+++ b/examples/bezier_tool/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas"] }
+iced.workspace = true
+iced.features = ["canvas"]
diff --git a/examples/bezier_tool/README.md b/examples/bezier_tool/README.md
index ebbb12cc..6dc13785 100644
--- a/examples/bezier_tool/README.md
+++ b/examples/bezier_tool/README.md
@@ -5,9 +5,7 @@ A Paint-like tool for drawing Bézier curves using the `Canvas` widget.
The __[`main`]__ file contains all the code of the example.
<div align="center">
- <a href="https://gfycat.com/soulfulinfiniteantbear">
- <img src="https://thumbs.gfycat.com/SoulfulInfiniteAntbear-small.gif">
- </a>
+ <img src="https://iced.rs/examples/bezier_tool.gif">
</div>
You can run it with `cargo run`:
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs
index 310be28f..56cb23ba 100644
--- a/examples/bezier_tool/src/main.rs
+++ b/examples/bezier_tool/src/main.rs
@@ -81,7 +81,7 @@ mod bezier {
}
pub fn request_redraw(&mut self) {
- self.cache.clear()
+ self.cache.clear();
}
}
@@ -100,12 +100,9 @@ mod bezier {
bounds: Rectangle,
cursor: mouse::Cursor,
) -> (event::Status, Option<Curve>) {
- let cursor_position =
- if let Some(position) = cursor.position_in(bounds) {
- position
- } else {
- return (event::Status::Ignored, None);
- };
+ let Some(cursor_position) = cursor.position_in(bounds) else {
+ return (event::Status::Ignored, None);
+ };
match event {
Event::Mouse(mouse_event) => {