From: Ian Jackson Date: Wed, 8 Jul 2020 00:40:56 +0000 (+0100) Subject: include dragraise in pelem dataset X-Git-Tag: otter-0.2.0~1405 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9728847810435979f2191c13caefbed07585ca2b;p=otter.git include dragraise in pelem dataset --- diff --git a/src/pieces.rs b/src/pieces.rs index 4c6cf4c3..b4dc7899 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -9,6 +9,7 @@ define_index_type! { struct SimpleShape { desc : String, shape : String, + approx_dia : Coord, colours : IndexVec, } @@ -16,9 +17,11 @@ const SELECT_SCALE : f64 = 1.1; impl Piece for SimpleShape { fn svg_piece(&self, pri : &PieceRenderInstructions) -> String { - format!(r##""##, + format!(r##""##, self.colours[pri.face], - pri.id_x("base")) + pri.id_x("base"), + self.approx_dia / 2, + ) } fn svg_select(&self, pri : &PieceRenderInstructions) -> String { format!(r##""##, @@ -43,12 +46,14 @@ pub fn xxx_make_pieces() -> Vec<(Pos, Box)> { ([ 90, 80 ], Box::new(SimpleShape { desc : "circle".to_owned(), + approx_dia : 20, shape : r#""#.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(), colours : index_vec![ "blue".to_string(), "grey".to_string() ], })), diff --git a/templates/script.ts b/templates/script.ts index 01cfd2fb..934c1971 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -23,6 +23,7 @@ // // pelem // #piece{} +// .dragraise dragged more than this ? raise to top! // // currently-displayed version of the piece // to allow addition/removal of selected indication