Skip to content

Commit 64e65a8

Browse files
committed
Call Component::operate in Widget implementation
1 parent 22982c8 commit 64e65a8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

widget/src/component.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ pub trait Component<
100100
/// By default, it does nothing.
101101
fn diff(&self, _state: &mut Self::State) {}
102102

103-
/// Update the [`Component`] state based on the provided [`Operation`](widget::Operation)
103+
/// Run the provided [`widget::Operation`] on the [`Component`].
104104
///
105105
/// By default, it does nothing.
106106
fn operate(
107107
&self,
108+
_state: &Self::State,
108109
_bounds: Rectangle,
109-
_state: &mut Self::State,
110110
_operation: &mut dyn widget::Operation,
111111
) {
112112
}
@@ -351,13 +351,19 @@ where
351351

352352
fn operate(
353353
&mut self,
354-
state: &mut Tree,
354+
tree: &mut Tree,
355355
layout: Layout<'_>,
356356
renderer: &Renderer,
357357
operation: &mut dyn widget::Operation,
358358
) {
359+
self.component.operate(
360+
tree.state.downcast_ref(),
361+
layout.bounds(),
362+
operation,
363+
);
364+
359365
self.view.as_widget_mut().operate(
360-
&mut state.children[0],
366+
&mut tree.children[0],
361367
Layout::with_offset(
362368
layout.position() - Point::ORIGIN,
363369
&self.layout,

0 commit comments

Comments
 (0)