diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/layout/spacing.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/layout/spacing.rs')
| -rw-r--r-- | src/layout/spacing.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/layout/spacing.rs b/src/layout/spacing.rs deleted file mode 100644 index 361b03ee..00000000 --- a/src/layout/spacing.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::fmt::{self, Debug, Formatter}; - -use super::*; - -/// A node that adds spacing to its parent. -#[derive(Copy, Clone, PartialEq)] -pub struct SpacingNode { - /// The amount of spacing to insert. - pub amount: Length, - /// Defines how spacing interacts with surrounding spacing. - /// - /// Hard spacing (`softness = 0`) assures that a fixed amount of spacing - /// will always be inserted. Soft spacing (`softness >= 1`) will be consumed - /// by other spacing with lower softness and can be used to insert - /// overridable spacing, e.g. between words or paragraphs. - pub softness: u8, -} - -impl Layout for SpacingNode { - fn layout(&self, _: &mut LayoutContext, _: &Areas) -> Fragment { - Fragment::Spacing(self.amount) - } -} - -impl Debug for SpacingNode { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "Spacing({}, {})", self.amount, self.softness) - } -} - -impl From<SpacingNode> for Node { - fn from(spacing: SpacingNode) -> Self { - Self::Spacing(spacing) - } -} |
