let tc = OverlayTemplateContext {
label_text: label,
label_options: &self.text_options,
- label_y_adjust: self.text_options.size * SVG_FONT_Y_ADJUST_OF_FONT_SIZE,
+ label_y_adjust: self.text_options.y_adjust(),
cooldown_active,
radius: self.cooldown_radius,
}
impl TextOptions {
+ pub fn y_adjust(&self) -> f64 {
+ self.size * SVG_FONT_Y_ADJUST_OF_FONT_SIZE
+ }
+
pub fn start_element(&self) -> Html {
- let y_adj = self.size * SVG_FONT_Y_ADJUST_OF_FONT_SIZE;
hformat!{
r##"{} text-align="center" text-anchor="middle" x="0" y="{}" fill="{}" font-size="{}px""##,
HTML_TEXT_LABEL_ELEM_START,
- y_adj, &self.colour, self.size,
+ self.y_adjust(), &self.colour, self.size,
}
}
}