Increase popup font size and make configurable

main
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 name => (is => 'rw');
has link => (is => 'rw', alias => 'href'); has link => (is => 'rw', alias => 'href');
has description => (is => 'rw', alias => 'desc'); has description => (is => 'rw', alias => 'desc');
has 'font-size' => (is => 'rw', default => '2.5em');
has margin => (is => 'rw', default => 20); has margin => (is => 'rw', default => 20);
has 'stroke-width' => (is => 'rw', default => 2); 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 $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 $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}); 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; return $scaler;
} }
@ -59,9 +60,9 @@ sub _a { " a $_[0],$_[1] $_[2] $_[3] $_[4] $_[5],$_[6]"; }
# Split this out # 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); $div->tag('h3', style => 'margin-top: 0; margin-left: 0;')->tag('a', href => $link)->cdata($name);
foreach (split /\n/, $description) foreach (split /\n/, $description)
{ {

Loading…
Cancel
Save