-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
After some thinking, I think I came up with a solution:
At
Line 71 in 162a548
| pub(in crate::view) fn begin_view<V>(&self, args: V::Args<'_>, ui: &Ui) -> (ViewId, V::Response) |
and
Line 79 in 162a548
| fn update_view<V>(&self, parent: ViewId, args: V::Args<'_>, ui: &Ui) -> (ViewId, V::Response) |
We can pass in something like
enum Id {
Anonymous,
Named(Str)
}which could be stored on
Lines 277 to 284 in 162a548
| pub struct ViewNode { | |
| /// Your parents id, if you have one. | |
| pub parent: Option<ViewId>, | |
| /// Your childrens ids, if you have any | |
| pub children: Vec<ViewId>, | |
| pub(in crate::view) view: Lock<Slot>, | |
| pub(in crate::view) next: usize, | |
| } |
By default, views will have be Id::Anonymous. This'll also require duplicating:
Line 65 in 162a548
| pub fn show<'v, B>(&self, args: B) -> Response<<B::View as View>::Response> |
and
Line 72 in 162a548
| pub fn show_children<'v, B, R>( |
to have a
show_named(view, Id) and a show_named_children(view, Id, impl FnOnce(&Ui) -> R)
With this, then the logic here:
Line 90 in 162a548
| if type_id != TypeId::of::<V>() { |
self.nodes.borrow()[id].view.borrow().id() with the provided Id, if it doesn't match then we can remove/replace it as if the type didn't match.
Doing this will allow for a tab/screen view type to actually replace its content.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels