Add configurable coordinate colours

main
Daniel Asher Resnick 12 months ago
parent 33a1867641
commit 07c1494b77
  1. 2
      HexGrid/Tile.pm
  2. 6
      wiki-map.pl

@ -20,6 +20,7 @@ has colour => (is => 'rw', alias => 'color');
has opacity => (is => 'rw');
has images => (is => 'rw', alias => [qw(image background backgrounds)]);
has show_coords => (is => 'rw');
has coords_colour => (is => 'rw', default => 'white');
has css_class => (is => 'rw');
has id_suffix => (is => 'rw', default => '_tile');
@ -128,6 +129,7 @@ sub render($this, $container, $width, $height, $laters = undef)
{
my $text = $g->text(x => "@{[0.1 * $width]}", y => "@{[0.6 * $height]}", class => 'coords');
$text->{'font-size'} = '3em';
$text->{fill} = $this->{coords_colour};
$text->cdata("$this->{nw},$this->{sw}");
}
if(defined $this->{css_class}) { $g->{class} = $this->{css_class} }

@ -89,6 +89,8 @@ foreach my $page (values %{$region_query_results->{query}{pages}})
next unless $parsed_template;
say STDERR "Processing region: $page->{title}";
$region->{defaults}{colour} = $parsed_template->{named_params}{colour};
$region->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
if($regiondir)
{
$regions_by_subregion{$region->{name}} = $region->{name};
@ -120,6 +122,8 @@ foreach my $page (values %{$subregion_query_results->{query}{pages}})
say STDERR "Processing subregion: $page->{title}";
my $subregion = $grid->make_region($page->{title});
$subregion->{defaults}{colour} = $parsed_template->{named_params}{colour};
$subregion->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
if($regiondir)
{
my $region_name = $parsed_template->{positional_params}[0];
@ -155,6 +159,8 @@ foreach my $page (values %{$location_query_results->{query}{pages}})
my $location = $grid->make_region($page->{title});
$location->{defaults}{colour} = $parsed_template->{named_params}{colour};
$location->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
push @{$background_pages{"File:$parsed_template->{named_params}{background}"}}, $location;
my $region_name = $parsed_template->{positional_params}[1];
$regions_by_subregion{$location->{name}} = $region_name;

Loading…
Cancel
Save