summaryrefslogtreecommitdiff
path: root/src/library/insert.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-02-06 12:30:44 +0100
committerMartin Haug <mhaug@live.de>2021-02-06 12:30:44 +0100
commit80e076814dde330fb2136172580f11e939bc6601 (patch)
tree6cd3474ffa5e2aced38e47a7ef563ab8940612be /src/library/insert.rs
parent8469bad7487e111c8e5a0ec542f0232a0ebb4bdc (diff)
Merge `rect` and `box` 🦚
Diffstat (limited to 'src/library/insert.rs')
-rw-r--r--src/library/insert.rs37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/library/insert.rs b/src/library/insert.rs
index 169fad97..58e8a11c 100644
--- a/src/library/insert.rs
+++ b/src/library/insert.rs
@@ -4,43 +4,6 @@ use crate::env::{ImageResource, ResourceId};
use crate::layout::*;
use crate::prelude::*;
-/// `rect`: Layout content into a rectangle that also might have a fill.
-///
-/// # Named arguments
-/// - Width of the box: `width`, of type `linear` relative to parent width.
-/// - Height of the box: `height`, of type `linear` relative to parent height.
-pub fn rect(ctx: &mut EvalContext, args: &mut Args) -> Value {
- let snapshot = ctx.state.clone();
-
- let width = args.get(ctx, "width");
- let height = args.get(ctx, "height");
- let color = args.get(ctx, "color");
-
- let dirs = ctx.state.dirs;
- let align = ctx.state.align;
-
- ctx.start_content_group();
-
- if let Some(body) = args.find::<ValueTemplate>(ctx) {
- body.eval(ctx);
- }
-
- let children = ctx.end_content_group();
-
- let fill_if = |c| if c { Expansion::Fill } else { Expansion::Fit };
- let expand = Spec::new(fill_if(width.is_some()), fill_if(height.is_some()));
-
- ctx.push(NodeRect {
- width,
- height,
- color,
- child: NodeStack { dirs, align, expand, children }.into(),
- });
-
- ctx.state = snapshot;
- Value::None
-}
-
/// `image`: Insert an image.
///
/// Supports PNG and JPEG files.