This commit is contained in:
Nathan Sobo 2023-08-10 10:26:48 -06:00
parent dd6425e898
commit 0bf607cd2d
48 changed files with 319 additions and 325 deletions

View file

@ -3,16 +3,15 @@ use std::ops::Range;
use crate::{
geometry::{rect::RectF, vector::Vector2F},
json::json,
AnyElement, Element, LayoutContext, PaintContext, SceneBuilder, SizeConstraint, View,
ViewContext,
AnyElement, Element, LayoutContext, PaintContext, SceneBuilder, SizeConstraint, ViewContext,
};
pub struct Hook<V: View> {
pub struct Hook<V> {
child: AnyElement<V>,
after_layout: Option<Box<dyn FnMut(Vector2F, &mut ViewContext<V>)>>,
}
impl<V: View> Hook<V> {
impl<V: 'static> Hook<V> {
pub fn new(child: impl Element<V>) -> Self {
Self {
child: child.into_any(),
@ -29,7 +28,7 @@ impl<V: View> Hook<V> {
}
}
impl<V: View> Element<V> for Hook<V> {
impl<V: 'static> Element<V> for Hook<V> {
type LayoutState = ();
type PaintState = ();