From c93297d8457004c9f07727da808cb59267d80715 Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Sun, 23 Jul 2023 13:19:03 -0500 Subject: [PATCH] Increase popup font size and make configurable --- HexGrid/PopUp.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HexGrid/PopUp.pm b/HexGrid/PopUp.pm index df00e77..1544772 100644 --- a/HexGrid/PopUp.pm +++ b/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) {