Increase popup font size and make configurable

main
Daniel Asher Resnick 10 months ago
parent 5e1eccfb20
commit c93297d845
  1. 7
      HexGrid/PopUp.pm

@ -19,6 +19,7 @@ has gap_width => (is => 'rw', default => 40);
has name => (is => 'rw');
has link => (is => 'rw', alias => 'href');
has description => (is => 'rw', alias => 'desc');
has 'font-size' => (is => 'rw', default => '2.5em');
has margin => (is => 'rw', default => 20);
has 'stroke-width' => (is => 'rw', default => 2);
@ -47,7 +48,7 @@ sub render($this, $scaler)
my $path = $scaler->path(d => $path_string, stroke => 'black', fill => 'white', 'stroke-width' => $t{'stroke-width'});
my $content_container = $scaler->g(transform => "translate($t{margin},$t{margin})");
my $obj = $content_container->foreignObject(width => ($t{width} - 2*$t{margin}), height => $box_height - 2*$t{margin});
basic_popup($obj, $t{name}, $t{description}, $t{link});
basic_popup($obj, $t{name}, $t{description}, $t{link}, $t{'font-size'});
return $scaler;
}
@ -59,9 +60,9 @@ sub _a { " a $_[0],$_[1] $_[2] $_[3] $_[4] $_[5],$_[6]"; }
# Split this out
sub basic_popup($obj, $name, $description, $link)
sub basic_popup($obj, $name, $description, $link, $font_size)
{
my $div = $obj->tag('div', xmlns => "http://www.w3.org/1999/xhtml");
my $div = $obj->tag('div', style => "font-size: $font_size;", xmlns => "http://www.w3.org/1999/xhtml");
$div->tag('h3', style => 'margin-top: 0; margin-left: 0;')->tag('a', href => $link)->cdata($name);
foreach (split /\n/, $description)
{

Loading…
Cancel
Save