Element refinement passing on ui2

This commit is contained in:
Nathan Sobo 2023-11-18 20:05:47 -07:00
parent be33f000e2
commit adc355a1e6
87 changed files with 2066 additions and 1372 deletions

View file

@ -2,8 +2,8 @@ use smallvec::SmallVec;
use taffy::style::{Display, Position};
use crate::{
point, AnyElement, BorrowWindow, Bounds, Component, Element, LayoutId, ParentComponent, Pixels,
Point, Size, Style,
point, AnyElement, BorrowWindow, Bounds, Element, LayoutId, ParentElement, Pixels, Point,
RenderOnce, Size, Style,
};
pub struct OverlayState {
@ -51,18 +51,12 @@ impl<V> Overlay<V> {
}
}
impl<V: 'static> ParentComponent<V> for Overlay<V> {
impl<V: 'static> ParentElement<V> for Overlay<V> {
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {
&mut self.children
}
}
impl<V: 'static> Component<V> for Overlay<V> {
fn render(self) -> AnyElement<V> {
AnyElement::new(self)
}
}
impl<V: 'static> Element<V> for Overlay<V> {
type State = OverlayState;
@ -163,6 +157,14 @@ impl<V: 'static> Element<V> for Overlay<V> {
}
}
impl<V: 'static> RenderOnce<V> for Overlay<V> {
type Element = Self;
fn render_once(self) -> Self::Element {
self
}
}
enum Axis {
Horizontal,
Vertical,