Introduce Shell type in iced_native
Widgets now can invalidate the current layout of the application on demand.
This commit is contained in:
parent
f7792d89d6
commit
bbd9355450
26 changed files with 218 additions and 130 deletions
|
|
@ -8,7 +8,7 @@ use crate::renderer;
|
|||
use crate::touch;
|
||||
use crate::{
|
||||
Background, Clipboard, Color, Element, Hasher, Layout, Length, Point,
|
||||
Rectangle, Size, Widget,
|
||||
Rectangle, Shell, Size, Widget,
|
||||
};
|
||||
|
||||
use std::hash::Hash;
|
||||
|
|
@ -191,7 +191,7 @@ where
|
|||
cursor_position: Point,
|
||||
_renderer: &Renderer,
|
||||
_clipboard: &mut dyn Clipboard,
|
||||
messages: &mut Vec<Message>,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
) -> event::Status {
|
||||
let is_dragging = self.state.is_dragging;
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ where
|
|||
};
|
||||
|
||||
if (self.value.into() - new_value.into()).abs() > f64::EPSILON {
|
||||
messages.push((self.on_change)(new_value));
|
||||
shell.publish((self.on_change)(new_value));
|
||||
|
||||
self.value = new_value;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ where
|
|||
| Event::Touch(touch::Event::FingerLost { .. }) => {
|
||||
if is_dragging {
|
||||
if let Some(on_release) = self.on_release.clone() {
|
||||
messages.push(on_release);
|
||||
shell.publish(on_release);
|
||||
}
|
||||
self.state.is_dragging = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue