From 980fb2ae87137de5a77c7d7b98974683563361a4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 24 Mar 2021 15:39:44 +0000 Subject: [PATCH] labels: wip generalisation - rename Signed-off-by: Ian Jackson --- src/hand.rs | 6 +++--- src/spec.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hand.rs b/src/hand.rs index dd3b8a73..36226dd1 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -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, + label: Option, } #[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]; diff --git a/src/spec.rs b/src/spec.rs index c2887734..9a1f1166 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -246,17 +246,17 @@ pub mod piece_specs { pub edge: Option, pub edge_width: Option, pub shape: Outline, - pub label: Option, + pub label: Option, } #[derive(Debug,Clone,Serialize,Deserialize)] - pub struct HandLabel { - #[serde(default)] pub place: HandLabelPlace, + pub struct PieceLabel { + #[serde(default)] pub place: PieceLabelPlace, pub colour: Option, } #[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 } } -- 2.30.2