Eliminate LayoutContext
This commit is contained in:
parent
ebf8b32811
commit
a24d94cfda
35 changed files with 108 additions and 203 deletions
|
@ -2,7 +2,7 @@ use std::{any::Any, marker::PhantomData};
|
|||
|
||||
use pathfinder_geometry::{rect::RectF, vector::Vector2F};
|
||||
|
||||
use crate::{AnyElement, Element, LayoutContext, PaintContext, SizeConstraint, ViewContext};
|
||||
use crate::{AnyElement, Element, PaintContext, SizeConstraint, ViewContext};
|
||||
|
||||
use super::Empty;
|
||||
|
||||
|
@ -282,14 +282,14 @@ impl<V: 'static, C: StatefulComponent<V> + 'static> Element<V> for ComponentAdap
|
|||
&mut self,
|
||||
constraint: SizeConstraint,
|
||||
view: &mut V,
|
||||
cx: &mut LayoutContext<V>,
|
||||
cx: &mut ViewContext<V>,
|
||||
) -> (Vector2F, Self::LayoutState) {
|
||||
if self.element.is_none() {
|
||||
let element = self
|
||||
.component
|
||||
.take()
|
||||
.expect("Component can only be rendered once")
|
||||
.render(view, cx.view_context());
|
||||
.render(view, cx);
|
||||
self.element = Some(element);
|
||||
}
|
||||
let constraint = self.element.as_mut().unwrap().layout(constraint, view, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue