From fa917c295c7da3d94421d33ced3302ad58c56ced Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 12 Jul 2020 11:51:58 +0100 Subject: [PATCH] paths inside SimpleShape nfc we will want this so we can do last-moved highlighting --- src/pieces.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pieces.rs b/src/pieces.rs index ee455883..6009baff 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -8,7 +8,7 @@ define_index_type! { #[derive(Debug)] struct SimpleShape { desc : String, - shape : String, + path : String, approx_dia : Coord, colours : IndexVec, } @@ -32,7 +32,7 @@ impl Piece for SimpleShape { } fn svg_x_ids(&self) -> VisiblePieceIdSvgIds { &["base"] } fn svg_x_defs(&self, pri : &PieceRenderInstructions) -> String { - format!(r#"{}"#, pri.id_x("base"), self.shape) + format!(r#""#, pri.id_x("base"), self.path) } fn describe_html(&self, face : Option) -> String { if let Some(face) = face { @@ -49,14 +49,15 @@ pub fn xxx_make_pieces() -> Vec<(Pos, Box)> { Box::new(SimpleShape { desc : "circle".to_owned(), approx_dia : 20, - shape : r#""#.to_owned(), + path : "M 10 0 a 10 10 0 1 0 -20 0\ + a 10 10 0 1 0 20 0".to_owned(), colours : index_vec![ "red".to_string(), "grey".to_string() ], })), ([ 90, 60 ], Box::new(SimpleShape { desc : "square".to_owned(), approx_dia : 20, - shape : r#""#.to_owned(), + path : "M -10 -10 h 20 v 20 h -20 v -20".to_owned(), colours : index_vec![ "blue".to_string(), "grey".to_string() ], })), ] -- 2.30.2