WIP
This commit is contained in:
parent
76754c559c
commit
922bb3195b
9 changed files with 82 additions and 218 deletions
|
@ -147,7 +147,6 @@ pub struct AnyView {
|
|||
model: AnyModel,
|
||||
initialize: fn(&AnyView, &mut WindowContext) -> AnyBox,
|
||||
layout: fn(&AnyView, &mut AnyBox, &mut WindowContext) -> LayoutId,
|
||||
prepaint: fn(&AnyView, &mut AnyBox, &mut WindowContext),
|
||||
paint: fn(&AnyView, &mut AnyBox, &mut WindowContext),
|
||||
}
|
||||
|
||||
|
@ -157,7 +156,6 @@ impl AnyView {
|
|||
model: self.model.downgrade(),
|
||||
initialize: self.initialize,
|
||||
layout: self.layout,
|
||||
prepaint: self.prepaint,
|
||||
paint: self.paint,
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +167,6 @@ impl AnyView {
|
|||
model,
|
||||
initialize: self.initialize,
|
||||
layout: self.layout,
|
||||
prepaint: self.prepaint,
|
||||
paint: self.paint,
|
||||
}),
|
||||
}
|
||||
|
@ -201,7 +198,6 @@ impl<V: Render> From<View<V>> for AnyView {
|
|||
model: value.model.into_any(),
|
||||
initialize: any_view::initialize::<V>,
|
||||
layout: any_view::layout::<V>,
|
||||
prepaint: any_view::prepaint::<V>,
|
||||
paint: any_view::paint::<V>,
|
||||
}
|
||||
}
|
||||
|
@ -232,16 +228,6 @@ impl<ParentViewState: 'static> Element<ParentViewState> for AnyView {
|
|||
(self.layout)(self, rendered_element, cx)
|
||||
}
|
||||
|
||||
fn prepaint(
|
||||
&mut self,
|
||||
bounds: Bounds<Pixels>,
|
||||
view_state: &mut ParentViewState,
|
||||
rendered_element: &mut Self::ElementState,
|
||||
cx: &mut ViewContext<ParentViewState>,
|
||||
) {
|
||||
(self.prepaint)(self, rendered_element, cx)
|
||||
}
|
||||
|
||||
fn paint(
|
||||
&mut self,
|
||||
_bounds: Bounds<Pixels>,
|
||||
|
@ -257,7 +243,6 @@ pub struct AnyWeakView {
|
|||
model: AnyWeakModel,
|
||||
initialize: fn(&AnyView, &mut WindowContext) -> AnyBox,
|
||||
layout: fn(&AnyView, &mut AnyBox, &mut WindowContext) -> LayoutId,
|
||||
prepaint: fn(&AnyView, &mut AnyBox, &mut WindowContext),
|
||||
paint: fn(&AnyView, &mut AnyBox, &mut WindowContext),
|
||||
}
|
||||
|
||||
|
@ -268,7 +253,6 @@ impl AnyWeakView {
|
|||
model,
|
||||
initialize: self.initialize,
|
||||
layout: self.layout,
|
||||
prepaint: self.prepaint,
|
||||
paint: self.paint,
|
||||
})
|
||||
}
|
||||
|
@ -280,7 +264,6 @@ impl<V: Render> From<WeakView<V>> for AnyWeakView {
|
|||
model: view.model.into(),
|
||||
initialize: any_view::initialize::<V>,
|
||||
layout: any_view::layout::<V>,
|
||||
prepaint: any_view::prepaint::<V>,
|
||||
paint: any_view::paint::<V>,
|
||||
}
|
||||
}
|
||||
|
@ -326,18 +309,6 @@ mod any_view {
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn prepaint<V: Render>(
|
||||
view: &AnyView,
|
||||
element: &mut Box<dyn Any>,
|
||||
cx: &mut WindowContext,
|
||||
) {
|
||||
cx.with_element_id(view.model.entity_id, |_, cx| {
|
||||
let view = view.clone().downcast::<V>().unwrap();
|
||||
let element = element.downcast_mut::<AnyElement<V>>().unwrap();
|
||||
view.update(cx, |view, cx| element.prepaint(view, cx))
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn paint<V: Render>(
|
||||
view: &AnyView,
|
||||
element: &mut Box<dyn Any>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue