From 3ca5b238238e1128aa7bbfbd5db9e632045d8600 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 28 Feb 2022 15:50:48 +0100 Subject: Reorganize library --- src/library/layout/align.rs | 71 +++++ src/library/layout/columns.rs | 111 ++++++++ src/library/layout/container.rs | 24 ++ src/library/layout/flow.rs | 272 +++++++++++++++++++ src/library/layout/grid.rs | 579 ++++++++++++++++++++++++++++++++++++++++ src/library/layout/hide.rs | 30 +++ src/library/layout/mod.rs | 27 ++ src/library/layout/pad.rs | 83 ++++++ src/library/layout/page.rs | 419 +++++++++++++++++++++++++++++ src/library/layout/place.rs | 59 ++++ src/library/layout/spacing.rs | 52 ++++ src/library/layout/stack.rs | 259 ++++++++++++++++++ src/library/layout/transform.rs | 86 ++++++ 13 files changed, 2072 insertions(+) create mode 100644 src/library/layout/align.rs create mode 100644 src/library/layout/columns.rs create mode 100644 src/library/layout/container.rs create mode 100644 src/library/layout/flow.rs create mode 100644 src/library/layout/grid.rs create mode 100644 src/library/layout/hide.rs create mode 100644 src/library/layout/mod.rs create mode 100644 src/library/layout/pad.rs create mode 100644 src/library/layout/page.rs create mode 100644 src/library/layout/place.rs create mode 100644 src/library/layout/spacing.rs create mode 100644 src/library/layout/stack.rs create mode 100644 src/library/layout/transform.rs (limited to 'src/library/layout') diff --git a/src/library/layout/align.rs b/src/library/layout/align.rs new file mode 100644 index 00000000..7fbe0d01 --- /dev/null +++ b/src/library/layout/align.rs @@ -0,0 +1,71 @@ +use crate::library::prelude::*; +use crate::library::text::ParNode; + +/// Align a node along the layouting axes. +#[derive(Debug, Hash)] +pub struct AlignNode { + /// How to align the node horizontally and vertically. + pub aligns: Spec>, + /// The node to be aligned. + pub child: LayoutNode, +} + +#[class] +impl AlignNode { + fn construct(_: &mut Context, args: &mut Args) -> TypResult