summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-05 20:29:55 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-05 20:29:55 +0100
commitf5b104d0da1c414fb59878d7378add316ee14798 (patch)
tree56968591bd997aa78cb8690da318ee97a822f2a9 /src/layout/mod.rs
parent72a9631b038d1a60e4e4a78e92cd69e6f8ce4316 (diff)
Rename crate `typst` -> `typstc` ✏
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index e31d2c17..afdab1ef 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -26,7 +26,7 @@ pub mod layouters {
pub use super::text::{layout_text, TextContext};
}
-pub use actions::{LayoutAction, LayoutActionList};
+pub use actions::{LayoutAction, LayoutActions};
pub use layouters::*;
/// A collection of layouts.
@@ -75,7 +75,7 @@ pub struct LayoutSpace {
pub padding: SizeBox,
/// Whether to expand the dimensions of the resulting layout to the full
/// dimensions of this space or to shrink them to fit the content for the
- /// vertical and horizontal axis.
+ /// horizontal and vertical axis.
pub expand: (bool, bool),
}
@@ -324,17 +324,6 @@ impl Alignment {
}
}
-/// The specialized anchor position for an item with the given alignment in a
-/// container with a given size along the given axis.
-pub fn anchor(axis: Axis, size: Size, alignment: Alignment) -> Size {
- use Alignment::*;
- match (axis.is_positive(), alignment) {
- (true, Origin) | (false, End) => Size::zero(),
- (_, Center) => size / 2,
- (true, End) | (false, Origin) => size,
- }
-}
-
/// Whitespace between boxes with different interaction properties.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SpacingKind {
@@ -368,6 +357,18 @@ impl LastSpacing {
}
}
+/// The specialized anchor position for an item with the given alignment in a
+/// container with a given size along the given axis.
+#[allow(dead_code)]
+fn anchor(axis: Axis, size: Size, alignment: Alignment) -> Size {
+ use Alignment::*;
+ match (axis.is_positive(), alignment) {
+ (true, Origin) | (false, End) => Size::zero(),
+ (_, Center) => size / 2,
+ (true, End) | (false, Origin) => size,
+ }
+}
+
/// Layout components that can be serialized.
pub trait Serialize {
/// Serialize the data structure into an output writable.