Stop paths from blocking clicks

main
Daniel Asher Resnick 4 weeks ago
parent 55d9a76281
commit 809086c676
  1. 11
      HexGrid.pm
  2. 4
      HexGrid/Path.pm

@ -31,6 +31,7 @@ has make_popups => (is => 'rw', default => 1, alias => 'popups');
has popup_class => (is => 'rw', default => 'popup');
has hidden_popups => (is => 'rw', default => 1, alias => 'popups_are_hidden');
has embed_images => (is => 'rw', default => 1);
has path_class => (is => 'rw', default => 'path');
# Equilateral hexagon math
sub tile_width($this) { 2 * $this->{sideLength} }
@ -118,7 +119,8 @@ sub subgrid_for_regions($this, @region_names)
make_popups => $this->{make_popups},
popup_class => $this->{popup_class},
hidden_popups => $this->{hidden_popups},
embed_images => $this->{embed_images}
embed_images => $this->{embed_images},
path_class => $this->{path_class}
);
$subgrid->add_region($this->{regions}{$_}) for @region_names;
foreach my $path (values %{$this->paths})
@ -142,7 +144,9 @@ sub subgrid_for_tiles($this, @coords_list)
make_popups => $this->{make_popups},
popup_class => $this->{popup_class},
hidden_popups => $this->{hidden_popups},
embed_images => $this->{embed_images}
embed_images => $this->{embed_images},
path_class => $this->{path_class}
);
foreach my $coords (@coords_list)
{
@ -193,7 +197,8 @@ sub render($this)
my $svg = SVG->new();
my $root_style = $svg->style();
my $style_text = "";
$style_text .= ".$this->{popup_class} { visibility: hidden; }" if $this->{hidden_popups};
$style_text .= ".$this->{popup_class} { visibility: hidden; }\n" if $this->{hidden_popups};
$style_text .= ".$this->{path_class} { pointer-events: none; }\n";
$root_style->cdata($style_text);
my $defs = $svg->defs();

@ -15,7 +15,7 @@ has tiles => (is => 'rw', default => sub { [] });
has id => (is => 'ro', required => 1);
has style => (is => 'rw', default => sub { {} });
has colour => (is => 'rw', alias => 'color', default => 'blue');
has css_class => (is => 'rw');
has css_class => (is => 'rw', default => 'path');
has starts_from => (is => 'rw');
has ends_to => (is => 'rw');
@ -126,7 +126,7 @@ sub splinter($this, $grid)
return;
}
$splinters[$#splinters]{ends_to} = $ending_edge;
}
}
}

Loading…
Cancel
Save