From d8a61d4440c656bfb197105d24be5c1a4b14331d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 11 Jan 2021 00:50:06 +0000 Subject: [PATCH] otterlib: wip preview Signed-off-by: Ian Jackson --- src/bin/otterlib.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 655e7d51..03cbcf83 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -44,8 +44,27 @@ fn preview(items: Vec) { let max_faces = pieces.iter().map(|(p,_)| p.nfaces()).max().unwrap_or(1); let max_uos = pieces.iter().map(|(_,uos)| uos.len()).max().unwrap_or(0); - dbg!(&pieces); - dbg!(&max_faces, &max_uos); + + println!(""); + for (pc, uos) in &pieces { + println!("", pc.describe_html(None).0); + for face in 0..max_faces { + println!(""); + }; + println!(""); + } + println!("
{}"); + if face < pc.nfaces() { + let pri = PieceRenderInstructions { + id: default(), + angle: VisiblePieceAngle(default()), + face: face.into(), + }; + let mut html = Html("".into()); + pc.svg_piece(&mut html, &pri)?; + println!("SVG\n{}\n\n", html.0); + } + println!("
"); } #[throws(anyhow::Error)] -- 2.30.2