diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-30 18:54:46 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-30 18:54:46 +0100 |
| commit | 5782b82770f6923677942c3b4e2bf4f7258e47d8 (patch) | |
| tree | 2b477fc285e9da5380e556648056b985ecbccfe0 /src/layout/actions.rs | |
| parent | b13ed627fff73a599b34d760cd99aa2f08d58ea8 (diff) | |
Refactor layouting base ♻
Diffstat (limited to 'src/layout/actions.rs')
| -rw-r--r-- | src/layout/actions.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/layout/actions.rs b/src/layout/actions.rs index c668cf75..2528fc85 100644 --- a/src/layout/actions.rs +++ b/src/layout/actions.rs @@ -1,10 +1,8 @@ //! Drawing and cofiguration actions composing layouts. use std::fmt::{self, Display, Formatter}; -use std::io::{self, Write}; -use super::Layout; -use crate::size::{Size, Size2D}; +use super::*; use LayoutAction::*; /// A layouting action. @@ -21,9 +19,8 @@ pub enum LayoutAction { DebugBox(Size2D, Size2D), } -impl LayoutAction { - /// Serialize this layout action into an easy-to-parse string representation. - pub fn serialize<W: Write>(&self, f: &mut W) -> io::Result<()> { +impl Serialize for LayoutAction { + fn serialize<W: Write>(&self, f: &mut W) -> io::Result<()> { match self { MoveAbsolute(s) => write!(f, "m {:.4} {:.4}", s.x.to_pt(), s.y.to_pt()), SetFont(i, s) => write!(f, "f {} {}", i, s.to_pt()), @@ -121,10 +118,6 @@ impl LayoutActionList { self.origin = position; self.next_pos = Some(position); - if layout.debug_render { - self.actions.push(DebugBox(position, layout.dimensions)); - } - self.extend(layout.actions); } |
