chiark / gitweb /
Provide cooldown timer stroke width to Rust
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 19:34:49 +0000 (20:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 21:43:43 +0000 (22:43 +0100)
We now have this in two places which is a bit poor, but we already
have some duplication between die.svg and the Rust code - eg, the path
generation which was just c&p.

I have left a comment.  And arranged to filter it out for distribution.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dice/cooldown-template-extractor
dice/die.svg
src/dice.rs

index d1051a290481dd3a7bbe1b4dbd1eaf216f73c3c1..2179a1e10e7ee6fa3c1531f19317c8cb4850a5df 100755 (executable)
@@ -39,6 +39,9 @@ sub filter_element ($@) {
     next if $keep_attr{$name};
     $node->removeAttribute($name);
   }
+  foreach my $desc_node ($node->getChildrenByTagName('desc')) {
+    $node->removeChild($desc_node);
+  }
 }
 sub filter_circle () {
   my @xy = qw(cx cy);
index 696c9ba37c4718d7ca773c262593e33d21190e92..ab15808ab002f1702253ae1ec5c3d1bd42c6f450 100644 (file)
        cx="0"
        cy="0"
        r="8"
-       inkscape:label="timeblack" />
+       inkscape:label="timeblack">
+      <desc
+         id="desc829">OUTER BLACK LINE FOR COOLDOWN TIMER
+NOTE - CHANGING STROKE WITH - EDIT src/dice.rs COOLDOWN_STROKE_WIDTH</desc>
+    </circle>
     <circle
        id="path15199"
        style="fill:none;stroke:#ffffff;stroke-width:1.134;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
index e64bb5f4d3096e07d252e4c4ce55d769c8988222..b471471249b90b181c8e4b6d5e68b405c13e8b2d 100644 (file)
@@ -17,6 +17,9 @@ const MAX_COOLDOWN: Duration = Duration::from_secs(100);
 fn default_cooldown() -> Duration { Duration::from_millis(4000) }
 fn default_circle_scale() -> f64 { 1. }
 
+// Copy of the value from die.svg's "timeblack"'s stroke-width
+const COOLDOWN_STROKE_WIDTH: f64 = 1.512;
+
 const COOLDOWN_EXTRA_RADIUS: f64 = DEFAULT_EDGE_WIDTH * 2. + 0.2;
 
 #[derive(Debug,Serialize,Deserialize)]