$node->setAttribute('r', "{{radius}}");
}
+sub filter_text () {
+ filter_element('text', qw(x y font-family text-align text-anchor));
+ $node->setAttribute('font-size', "{{ label_font_size }}px");
+ $node->setAttribute('y', "{{ label_font_size * 0.35 }}");
+ $node->removeChildNodes();
+ $node->appendText('{{ label_text }}');
+}
+p "{% if label_text != \"\" %}\n";
+process_node('textlabel', \&filter_text);
+p "{% endif %}\n";
+
p "{% if cooldown_active %}\n";
process_node('timeblack', sub {
$nom_radius = $node->getAttribute('r');
0.5 * (SELECT_STROKE_WIDTH + COOLDOWN_STROKE_WIDTH) +
DEFAULT_EDGE_WIDTH;
+const DEFAULT_LABEL_FONT_SIZE: f64 = 8.;
+
#[derive(Debug,Serialize,Deserialize)]
pub struct Spec {
// must be >1 faces on image, or >1 texts, and if both, same number
#[derive(Serialize, Debug)]
struct OverlayTemplateContext<'c> {
+ label_text: &'c str,
+ label_font_size: f64,
+
cooldown_active: bool,
radius: f64,
remprop: f64,
let iface = if self.image.nfaces() == 1 { default() } else { face };
self.image.svg(f, vpid, iface, xdata)?;
+ let label = self.labels.get(face).map(|s| &**s).unwrap_or_else(
+ || self.labels.get(0).map(|s| &**s) .unwrap_or_default());
+
let remprop = self.cooldown_remprop(state)?;
let cooldown_active = remprop != 0.;
};
let tc = OverlayTemplateContext {
+ label_text: &label,
+ label_font_size: DEFAULT_LABEL_FONT_SIZE,
+
cooldown_active,
radius: self.cooldown_radius,
path_d: &path_d,