chiark / gitweb /
labels: wip generalisation - rename
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 24 Mar 2021 15:39:44 +0000 (15:39 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 24 Mar 2021 15:39:44 +0000 (15:39 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/hand.rs
src/spec.rs

index dd3b8a737865efca1b42b2490375c4d4b9f8f255..36226dd1cbf1104e8a1aa1bf25b781d643aff864 100644 (file)
@@ -3,7 +3,7 @@
 // There is NO WARRANTY.
 
 use crate::prelude::*;
-use piece_specs::{HandLabel, HandLabelPlace};
+use piece_specs::{PieceLabel, PieceLabelPlace};
 
 pub const UNCLAIMED_DESC: &str = "a hand repository";
 
@@ -17,7 +17,7 @@ struct MagicOwner {
 #[derive(Debug,Serialize,Deserialize)]
 struct Hand {
   shape: GenericSimpleShape<(), shapelib::Rectangle>,
-  label: Option<HandLabel>,
+  label: Option<PieceLabel>,
 }
 
 #[derive(Debug,Clone,Default,Serialize,Deserialize)]
@@ -115,7 +115,7 @@ impl PieceTrait for Hand {
       };
       let fontsz = 4.;
       let PosC([x,y]) = {
-        use HandLabelPlace::*;
+        use PieceLabelPlace::*;
         let eff_size = (self.shape.outline.xy - PosC([2.,2.]))?;
         let mut pos = (eff_size * -0.5)?;
         let y = &mut pos.0[1];
index c2887734cfd3005836b50d8df55e30b5905bd8a4..9a1f1166bd44798ff1df06eaff9b357240a41ade 100644 (file)
@@ -246,17 +246,17 @@ pub mod piece_specs {
     pub edge: Option<ColourSpec>,
     pub edge_width: Option<f64>,
     pub shape: Outline,
-    pub label: Option<HandLabel>,
+    pub label: Option<PieceLabel>,
   }
 
   #[derive(Debug,Clone,Serialize,Deserialize)]
-  pub struct HandLabel {
-    #[serde(default)] pub place: HandLabelPlace,
+  pub struct PieceLabel {
+    #[serde(default)] pub place: PieceLabelPlace,
     pub colour: Option<ColourSpec>,
   }
 
   #[derive(Debug,Copy,Clone,Serialize,Deserialize,Eq,PartialEq)]
-  pub enum HandLabelPlace {
+  pub enum PieceLabelPlace {
     BottomLeft,
     TopLeft,
   }
@@ -459,7 +459,7 @@ pub mod implementation {
     }
   }
 
-  impl Default for piece_specs::HandLabelPlace {
+  impl Default for piece_specs::PieceLabelPlace {
     fn default() -> Self { Self::BottomLeft }
   }