summaryrefslogtreecommitdiff
path: root/src/library/boxed.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-11-25 16:56:29 +0100
committerLaurenz <laurmaedje@gmail.com>2020-11-25 16:56:29 +0100
commit11e44516fae84f907ea992311fcfdc3636101f14 (patch)
treeff9b6a04c3accd5c0f75f1ceb60e578c389a2606 /src/library/boxed.rs
parent761931405c68efe0a35d96524df797dda7155723 (diff)
Merge some modules 🥞
Diffstat (limited to 'src/library/boxed.rs')
-rw-r--r--src/library/boxed.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/library/boxed.rs b/src/library/boxed.rs
deleted file mode 100644
index 1ec17d88..00000000
--- a/src/library/boxed.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use crate::geom::Linear;
-use crate::layout::{Expansion, Fixed, Stack};
-use crate::prelude::*;
-
-/// `box`: Layouts its contents into a box.
-///
-/// # Keyword arguments
-/// - `width`: The width of the box (length or relative to parent's width).
-/// - `height`: The height of the box (length or relative to parent's height).
-pub fn boxed(mut args: Args, ctx: &mut EvalContext) -> Value {
- let snapshot = ctx.state.clone();
- let body = args.find::<SynTree>().unwrap_or_default();
- let width = args.get::<_, Linear>(ctx, "width");
- let height = args.get::<_, Linear>(ctx, "height");
- let main = args.get::<_, Spanned<Dir>>(ctx, "main");
- let cross = args.get::<_, Spanned<Dir>>(ctx, "cross");
- ctx.set_flow(Gen::new(main, cross));
- args.done(ctx);
-
- let flow = ctx.state.flow;
- let align = ctx.state.align;
-
- ctx.start_content_group();
- body.eval(ctx);
- let children = ctx.end_content_group();
-
- ctx.push(Fixed {
- width,
- height,
- child: LayoutNode::dynamic(Stack {
- flow,
- align,
- expansion: Spec::new(
- Expansion::fill_if(width.is_some()),
- Expansion::fill_if(height.is_some()),
- )
- .switch(flow),
- children,
- }),
- });
-
- ctx.state = snapshot;
- Value::None
-}