summaryrefslogtreecommitdiffstats
path: root/widget/src/canvas/program.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-10-28 16:58:00 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-11-05 23:52:58 +0100
commit920596ed6f44acf8d87d2135c1b8967bab23d5b9 (patch)
treeca3f673c01bf9abba79f6b5f172df189788d50de /widget/src/canvas/program.rs
parenta84b328dcc3e2f941f9595a2f8c3b1d061442722 (diff)
downloadiced-920596ed6f44acf8d87d2135c1b8967bab23d5b9.tar.gz
iced-920596ed6f44acf8d87d2135c1b8967bab23d5b9.tar.bz2
iced-920596ed6f44acf8d87d2135c1b8967bab23d5b9.zip
Implement `reactive-rendering` for `canvas`
Diffstat (limited to '')
-rw-r--r--widget/src/canvas/program.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/widget/src/canvas/program.rs b/widget/src/canvas/program.rs
index a7ded0f4..c68b2830 100644
--- a/widget/src/canvas/program.rs
+++ b/widget/src/canvas/program.rs
@@ -1,8 +1,8 @@
-use crate::canvas::event::{self, Event};
use crate::canvas::mouse;
-use crate::canvas::Geometry;
+use crate::canvas::{Event, Geometry};
use crate::core::Rectangle;
use crate::graphics::geometry;
+use crate::Action;
/// The state and logic of a [`Canvas`].
///
@@ -22,8 +22,9 @@ where
/// When a [`Program`] is used in a [`Canvas`], the runtime will call this
/// method for each [`Event`].
///
- /// This method can optionally return a `Message` to notify an application
- /// of any meaningful interactions.
+ /// This method can optionally return an [`Action`] to either notify an
+ /// application of any meaningful interactions, capture the event, or
+ /// request a redraw.
///
/// By default, this method does and returns nothing.
///
@@ -34,8 +35,8 @@ where
_event: Event,
_bounds: Rectangle,
_cursor: mouse::Cursor,
- ) -> (event::Status, Option<Message>) {
- (event::Status::Ignored, None)
+ ) -> Option<Action<Message>> {
+ None
}
/// Draws the state of the [`Program`], producing a bunch of [`Geometry`].
@@ -84,7 +85,7 @@ where
event: Event,
bounds: Rectangle,
cursor: mouse::Cursor,
- ) -> (event::Status, Option<Message>) {
+ ) -> Option<Action<Message>> {
T::update(self, state, event, bounds, cursor)
}