From: Ian Jackson Date: Mon, 11 Jan 2021 00:50:06 +0000 (+0000) Subject: otterlib: wip preview X-Git-Tag: otter-0.3.0~87 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d8a61d4440c656bfb197105d24be5c1a4b14331d;p=otter.git otterlib: wip preview Signed-off-by: Ian Jackson --- 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)]