Implement Widget::operate for lazy::Cached

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 02:30:41 +01:00
parent b5d33b0370
commit 54f9ab7d5f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -4,8 +4,9 @@ use iced_native::mouse;
use iced_native::overlay; use iced_native::overlay;
use iced_native::renderer; use iced_native::renderer;
use iced_native::widget::tree::{self, Tree}; use iced_native::widget::tree::{self, Tree};
use iced_native::widget::{self, Widget};
use iced_native::Element;
use iced_native::{Clipboard, Hasher, Length, Point, Rectangle, Shell, Size}; use iced_native::{Clipboard, Hasher, Length, Point, Rectangle, Shell, Size};
use iced_native::{Element, Widget};
use ouroboros::self_referencing; use ouroboros::self_referencing;
use std::cell::{Ref, RefCell, RefMut}; use std::cell::{Ref, RefCell, RefMut};
@ -125,6 +126,21 @@ where
}) })
} }
fn operate(
&self,
tree: &mut Tree,
layout: Layout<'_>,
operation: &mut dyn widget::Operation<Message>,
) {
self.with_element(|element| {
element.as_widget().operate(
&mut tree.children[0],
layout,
operation,
);
});
}
fn on_event( fn on_event(
&mut self, &mut self,
tree: &mut Tree, tree: &mut Tree,