This commit is contained in:
Nathan Sobo
2021-03-09 21:00:51 -07:00
parent a015c61337
commit 356bc41752
36 changed files with 14097 additions and 4 deletions
+45
View File
@@ -0,0 +1,45 @@
use crate::{
AfterLayoutContext, AppContext, Element, Event, EventContext, LayoutContext, MutableAppContext,
PaintContext, SizeConstraint,
};
use pathfinder_geometry::vector::Vector2F;
pub struct Empty {
size: Option<Vector2F>,
origin: Option<Vector2F>,
}
impl Empty {
pub fn new() -> Self {
Self {
size: None,
origin: None,
}
}
}
impl Element for Empty {
fn layout(
&mut self,
constraint: SizeConstraint,
_: &mut LayoutContext,
_: &AppContext,
) -> Vector2F {
self.size = Some(constraint.min);
constraint.max
}
fn after_layout(&mut self, _: &mut AfterLayoutContext, _: &mut MutableAppContext) {}
fn paint(&mut self, origin: Vector2F, _: &mut PaintContext, _: &AppContext) {
self.origin = Some(origin);
}
fn dispatch_event(&self, _: &Event, _: &mut EventContext, _: &AppContext) -> bool {
false
}
fn size(&self) -> Option<Vector2F> {
self.size
}
}