chiark / gitweb /
wip before more outline change
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jul 2020 17:19:10 +0000 (18:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jul 2020 17:19:10 +0000 (18:19 +0100)
src/gamestate.rs
src/pieces.rs

index 69f5e631d3ed713d6820d98ac90e588a0e03ff28..3be5c77176a7e8f535157aa061c0461edf29bbfd 100644 (file)
@@ -71,8 +71,10 @@ pub trait Piece : Send + Debug {
   // #[throws] doesn't work here for some reason
   fn svg_piece(&self, f: &mut String, pri: &PieceRenderInstructions) -> SR;
 
+/*
   #[throws(SE)]
   fn outline_path(&self, pri : &PieceRenderInstructions) -> String;
+*/
 
   #[throws(SE)]
   fn surround_path(&self, pri : &PieceRenderInstructions) -> String;
@@ -149,10 +151,9 @@ impl PieceState {
            r##"<path id="select{}" stroke="black" fill="none" d="{}"/>"##,
            pri.id, pr.p.surround_path(&pri)?)?;
     write!(defs,
-           r##"<path id="halo{}" stroke="none" fill="yellow" d="{} {}"/>"##,
+           r##"<path id="halo{}" stroke="yellow" stroke-width="2px" fill="none" d="{}"/>"##,
            pri.id,
-           pr.p.surround_path(&pri)?,
-           pr.p.outline_path(&pri)?)?;
+           pr.p.surround_path(&pri)?)?;
     pr.p.svg_x_defs(&mut defs, &pri)?;
     defs
   }
index c679e8a6bb8ed532f6e7c91f78176dd8d792501d..63a987f79be669cc5fe8b7cbe3bad5e702cc93f7 100644 (file)
@@ -86,12 +86,16 @@ impl Piece for SimpleShape {
   #[throws(SE)]
   fn svg_piece(&self, f: &mut String, pri: &PieceRenderInstructions) {
     write!(f, r##"<path fill="{}" d="{}"/>"##,
-           self.colours[pri.face], self.path)?;
+           self.colours[pri.face],
+           svg_rescale_path(&self.path, 0.5)?,
+    )?;
   }
+/*
   #[throws(SE)]
   fn outline_path(&self, _pri : &PieceRenderInstructions) -> String {
     self.path.clone()
   }
+*/
   #[throws(SE)]
   fn surround_path(&self, _pri : &PieceRenderInstructions) -> String {
     self.scaled_path.clone()