chiark / gitweb /
otterlib: wip preview, show surround
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Jan 2021 18:30:47 +0000 (18:30 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Jan 2021 20:18:59 +0000 (20:18 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/otterlib.rs

index e3b3da1b3b1950f0568547491348621ba702c799..98c757b94563e0a7d2ac202ee9aa2880c403fead 100644 (file)
@@ -127,13 +127,19 @@ fn preview(items: Vec<ItemForOutput>) {
           .join(" ");
         let wh = size.iter().map(|&s| s * SVG_SCALE)
           .collect::<Vec<_>>();
-        let surround = pc.surround_path(&pri);
+        let surround = pc.surround_path(&pri)?;
         print!(r#"<svg xmlns="http://www.w3.org/2000/svg"
                        viewBox="{}" width={} height={}>"#,
                &viewport, wh[0], wh[1]);
+        if inseveral == 1 {
+          let dasharray = player_dasharray(1.try_into().unwrap());
+          print!(r#"<path d="{}" stroke-dasharray="{}"
+                          fill="none" stroke="{}" />"#,
+                 &surround.0, &dasharray, HELD_SURROUND_COLOUR);
+        }
         let mut html = Html("".into());
         pc.svg_piece(&mut html, &pri)?;
-          println!("{}</svg>", html.0);
+        println!("{}</svg>", html.0);
 //        
 //        println!(r#"<svg viewBox="{}"> width={} height={} {:?}"#,
 //                 &viewport, size[0], size[1], &surround);