chiark / gitweb /
ui.rs: Bring a number of constants etc. together here
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 22:26:55 +0000 (23:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 22:26:55 +0000 (23:26 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs
src/pieces.rs
src/ui.rs

index e8c7fffb0c25bc5ba3e056f4508963fb4e97314c..9f2f33996a7673f68ed694e5fd41f6ac3711f050 100644 (file)
@@ -23,9 +23,6 @@ visible_slotmap_key!{ VisiblePieceId(b'.') }
 #[serde(transparent)]
 pub struct Timestamp(pub u64); /* time_t */
 
-pub const DEFAULT_TABLE_SIZE: Pos = PosC::new( 300, 200 );
-pub const DEFAULT_TABLE_COLOUR: &str = "green";
-
 #[derive(Copy,Clone,Debug,Eq,Ord,PartialEq,PartialOrd)]
 pub struct SpecDepth(u16);
 
index f41fadc77268847cccea2e44844996fb47dbeb0a..56e3dc7459bb7864a69292f4357aa7740dd6d9a0 100644 (file)
@@ -22,24 +22,6 @@ pub struct GenericSimpleShape<Desc, Outl> {
 }
 pub type SimpleShape = GenericSimpleShape<Html, Outline>;
 
-pub const SELECT_SCALE: f64 = 1.1;
-
-// also in script.ts:redisplay_ancillaries ("halo")
-//   nelem.setAttributeNS(null,'stroke-width','2px');
-pub const SELECT_STROKE_WIDTH: f64 = 2.0;
-
-pub const DEFAULT_EDGE_WIDTH: f64 = 0.2;
-pub const INVISIBLE_EDGE_SENSITIVE: f64 = 2.;
-
-// When trying to centre text, we use text-align and/or text-anchor
-// to do the horizontal positioning, but vertical positioning is
-// troublesome.  We bodge it.  Multiple the font size (in pixels)
-// by this, and add it to the SVG y coordinate (ie, shufting the text
-// down).
-pub const SVG_FONT_Y_ADJUST_OF_FONT_SIZE: f64 = 0.35;
-
-fn default_edge_width() -> f64 { DEFAULT_EDGE_WIDTH }
-
 #[derive(Copy,Clone,Debug,Error,Serialize,Deserialize)]
 pub enum SVGProcessingError {
   UnknownOperator,
index 855099cd75b0cb6558352d42c921c93af87ef977..7f2a6a8dded6d01460f143ef4701079deb2f4bd4 100644 (file)
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -9,6 +9,27 @@ pub const HELD_SURROUND_COLOUR: &str = "black";
 const MONOSPACE: HtmlLit = Html::lit(
   r#"font-family="Latin Modern Mono, monospace" font-weight="700""#);
 
+pub const DEFAULT_TABLE_SIZE: Pos = PosC::new( 300, 200 );
+pub const DEFAULT_TABLE_COLOUR: &str = "green";
+
+pub const SELECT_SCALE: f64 = 1.1;
+
+// also in script.ts:redisplay_ancillaries ("halo")
+//   nelem.setAttributeNS(null,'stroke-width','2px');
+pub const SELECT_STROKE_WIDTH: f64 = 2.0;
+
+pub const DEFAULT_EDGE_WIDTH: f64 = 0.2;
+pub const INVISIBLE_EDGE_SENSITIVE: f64 = 2.;
+
+// When trying to centre text, we use text-align and/or text-anchor
+// to do the horizontal positioning, but vertical positioning is
+// troublesome.  We bodge it.  Multiple the font size (in pixels)
+// by this, and add it to the SVG y coordinate (ie, shufting the text
+// down).
+pub const SVG_FONT_Y_ADJUST_OF_FONT_SIZE: f64 = 0.35;
+
+pub fn default_edge_width() -> f64 { DEFAULT_EDGE_WIDTH }
+
 pub fn monospace_font(size: u32) -> Html {
   hformat!(r##"{} font-size="{}""##, MONOSPACE, size)
 }