Only render popups and click events for html maps

main
Daniel Asher Resnick 11 months ago
parent 57eb487682
commit 5dee70cd48
  1. 7
      HexGrid/Pin.pm
  2. 3
      wiki-map.pl

@ -11,6 +11,7 @@ has id => (is => 'ro', required => 1);
has icon => (is => 'rw', alias => [qw(img source src)], required => 1); has icon => (is => 'rw', alias => [qw(img source src)], required => 1);
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 popup => (is => 'rw', default => 1, alias => 'use_popup');
has popup_class => (is => 'rw', default => 'pin-popup'); has popup_class => (is => 'rw', default => 'pin-popup');
@ -20,14 +21,16 @@ sub render($this, $pin_container, $x, $y, $w, $h, $laters = undef)
my $element = $group->use(href => "#$this->{icon}_symbol", my $element = $group->use(href => "#$this->{icon}_symbol",
x => $x, y => $y, width => $w, height => $h); x => $x, y => $y, width => $w, height => $h);
$element->{id} = "$this->{id}-use"; $element->{id} = "$this->{id}-use";
$element->{onclick} = "clickPin('$this->{id}', '$pin_container->{id}');"; $element->{onclick} = "clickPin('$this->{id}', '$pin_container->{id}');"
if $this->popup;
my $center_x = $x + $w/2; my $center_x = $x + $w/2;
my $center_y = $y + $h/2; my $center_y = $y + $h/2;
if(defined $laters) if(defined $laters)
{ {
push @$laters, sub ($popup_container) { $this->render_popup($popup_container, push @$laters, sub ($popup_container) { $this->render_popup($popup_container,
$pin_container->{transform}, $center_x, $center_y); }; $pin_container->{transform}, $center_x, $center_y); }
if $this->popup;
} }
return $group; return $group;
} }

@ -376,7 +376,8 @@ foreach my $site_page_ref (values %{$site_query_results->{query}{pages}})
id => HexGrid::to_id($site_name), id => HexGrid::to_id($site_name),
icon => HexGrid::to_id($parsed_template->{named_params}{icon}), icon => HexGrid::to_id($parsed_template->{named_params}{icon}),
link => $site_url, link => $site_url,
description => $parsed_template->{named_params}{abstract} description => $parsed_template->{named_params}{abstract},
popup => $html_document
); );
$tile->pin($pin); $tile->pin($pin);
} }

Loading…
Cancel
Save