diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:19:36 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:19:36 +0200 |
| commit | 92c01da36016e94ff20163806ddcbcf7e33d4031 (patch) | |
| tree | 1a900b3c11edcc93e9153fada3ce92310db5768b /src/layout/mod.rs | |
| parent | 42500d5ed85539c5ab04dd3544beaf802da29be9 (diff) | |
Switch back to custom geometry types, unified with layout primitives 🏞
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index bfd633d8..2368c441 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1,17 +1,28 @@ //! Layouting of documents. -pub mod nodes; -pub mod primitive; - -pub use primitive::*; +mod document; +mod fixed; +mod node; +mod pad; +mod par; +mod spacing; +mod stack; +mod text; use async_trait::async_trait; use crate::font::SharedFontLoader; -use crate::geom::{Point, Rect, Size, SizeExt}; +use crate::geom::*; use crate::shaping::Shaped; -use nodes::Document; +pub use document::*; +pub use fixed::*; +pub use node::*; +pub use pad::*; +pub use par::*; +pub use spacing::*; +pub use stack::*; +pub use text::*; /// Layout a document and return the produced layouts. pub async fn layout(document: &Document, loader: SharedFontLoader) -> Vec<BoxLayout> { @@ -53,9 +64,9 @@ pub trait Layout { #[derive(Debug, Clone, PartialEq)] pub enum LayoutItem { /// Spacing that should be added to the parent. - Spacing(f64), + Spacing(Length), /// A box that should be aligned in the parent. - Box(BoxLayout, Gen2<GenAlign>), + Box(BoxLayout, Gen<Align>), } /// The constraints for layouting a single node. @@ -101,7 +112,7 @@ impl BoxLayout { /// given position. pub fn push_layout(&mut self, pos: Point, more: Self) { for (subpos, element) in more.elements { - self.push(pos + subpos.to_vec2(), element); + self.push(pos + subpos, element); } } } |
