This commit is contained in:
Nathan Sobo 2023-04-12 12:10:43 -06:00
parent 40896352ff
commit a25f962185
90 changed files with 587 additions and 501 deletions

View file

@ -3,13 +3,13 @@ use std::ops::Range;
use crate::{
geometry::{rect::RectF, vector::Vector2F},
json::{self, json, ToJson},
Element, ElementBox, SceneBuilder, SizeConstraint, View, ViewContext,
Drawable, Element, SceneBuilder, SizeConstraint, View, ViewContext,
};
/// Element which renders it's children in a stack on top of each other.
/// The first child determines the size of the others.
pub struct Stack<V: View> {
children: Vec<ElementBox<V>>,
children: Vec<Element<V>>,
}
impl<V: View> Default for Stack<V> {
@ -26,7 +26,7 @@ impl<V: View> Stack<V> {
}
}
impl<V: View> Element<V> for Stack<V> {
impl<V: View> Drawable<V> for Stack<V> {
type LayoutState = ();
type PaintState = ();
@ -98,8 +98,8 @@ impl<V: View> Element<V> for Stack<V> {
}
}
impl<V: View> Extend<ElementBox<V>> for Stack<V> {
fn extend<T: IntoIterator<Item = ElementBox<V>>>(&mut self, children: T) {
impl<V: View> Extend<Element<V>> for Stack<V> {
fn extend<T: IntoIterator<Item = Element<V>>>(&mut self, children: T) {
self.children.extend(children)
}
}