From dcc184b01b753dbecb500205391f6eaaa21c8683 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 25 Oct 2024 19:28:18 +0200 Subject: Replace `event::Status` in `Widget::on_event` with `Shell::capture_event` --- widget/src/shader/program.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'widget/src/shader/program.rs') diff --git a/widget/src/shader/program.rs b/widget/src/shader/program.rs index 902c7c3b..5124a1cc 100644 --- a/widget/src/shader/program.rs +++ b/widget/src/shader/program.rs @@ -1,4 +1,3 @@ -use crate::core::event; use crate::core::mouse; use crate::core::{Rectangle, Shell}; use crate::renderer::wgpu::Primitive; @@ -31,8 +30,7 @@ pub trait Program { _bounds: Rectangle, _cursor: mouse::Cursor, _shell: &mut Shell<'_, Message>, - ) -> (event::Status, Option) { - (event::Status::Ignored, None) + ) { } /// Draws the [`Primitive`]. -- cgit From 6fc16769c4fb07d5e976a9c1762ecd17cf734bce Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 4 Nov 2024 18:26:46 +0100 Subject: Unify `shader::Program` API with `canvas::Program` --- widget/src/shader/program.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'widget/src/shader/program.rs') diff --git a/widget/src/shader/program.rs b/widget/src/shader/program.rs index 5124a1cc..0fc110af 100644 --- a/widget/src/shader/program.rs +++ b/widget/src/shader/program.rs @@ -1,7 +1,7 @@ use crate::core::mouse; -use crate::core::{Rectangle, Shell}; +use crate::core::Rectangle; use crate::renderer::wgpu::Primitive; -use crate::shader; +use crate::shader::{self, Action}; /// The state and logic of a [`Shader`] widget. /// @@ -17,10 +17,10 @@ pub trait Program { type Primitive: Primitive + 'static; /// Update the internal [`State`] of the [`Program`]. This can be used to reflect state changes - /// based on mouse & other events. You can use the [`Shell`] to publish messages, request a - /// redraw for the window, etc. + /// based on mouse & other events. You can return an [`Action`] to publish a message, request a + /// redraw, or capture the event. /// - /// By default, this method does and returns nothing. + /// By default, this method returns `None`. /// /// [`State`]: Self::State fn update( @@ -29,8 +29,8 @@ pub trait Program { _event: shader::Event, _bounds: Rectangle, _cursor: mouse::Cursor, - _shell: &mut Shell<'_, Message>, - ) { + ) -> Option> { + None } /// Draws the [`Primitive`]. -- cgit