summaryrefslogtreecommitdiff
path: root/library/src/layout/container.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-12 23:25:54 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-12 23:46:26 +0100
commitbf59c08a0a601eeac4354c505cab15e65601c8e8 (patch)
tree2ba3230c77960acf5d55ee34065a5028d1c45d5d /library/src/layout/container.rs
parentd9ce194fe71076314955dd25896f64d48bccd6e5 (diff)
New interaction model
Diffstat (limited to 'library/src/layout/container.rs')
-rw-r--r--library/src/layout/container.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs
index 22a9e02e..20d80cba 100644
--- a/library/src/layout/container.rs
+++ b/library/src/layout/container.rs
@@ -66,19 +66,25 @@ pub struct BlockNode(pub Content);
impl BlockNode {
/// The spacing between the previous and this block.
#[property(skip)]
- pub const ABOVE: VNode = VNode::weak(Em::new(1.2).into());
+ pub const ABOVE: VNode = VNode::block_spacing(Em::new(1.2).into());
/// The spacing between this and the following block.
#[property(skip)]
- pub const BELOW: VNode = VNode::weak(Em::new(1.2).into());
+ pub const BELOW: VNode = VNode::block_spacing(Em::new(1.2).into());
fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.eat()?.unwrap_or_default()).pack())
}
fn set(...) {
- let spacing = args.named("spacing")?.map(VNode::weak);
- styles.set_opt(Self::ABOVE, args.named("above")?.map(VNode::strong).or(spacing));
- styles.set_opt(Self::BELOW, args.named("below")?.map(VNode::strong).or(spacing));
+ let spacing = args.named("spacing")?.map(VNode::block_spacing);
+ styles.set_opt(
+ Self::ABOVE,
+ args.named("above")?.map(VNode::block_around).or(spacing),
+ );
+ styles.set_opt(
+ Self::BELOW,
+ args.named("below")?.map(VNode::block_around).or(spacing),
+ );
}
}