You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
704 B
28 lines
704 B
1 year ago
|
package HexGrid::Image;
|
||
|
|
||
|
use v5.30;
|
||
|
|
||
|
use Moo;
|
||
|
use MooX::Aliases;
|
||
|
|
||
|
use feature "signatures";
|
||
|
no warnings "experimental::signatures";
|
||
|
|
||
|
|
||
|
has source => (is => 'rw', required => 1, alias => [qw(src url source_url)]);
|
||
|
has fetch => (is => 'rw', default => 0);
|
||
|
has id => (is => 'rw', required => 1);
|
||
|
has width => (is => 'rw', required => 1);
|
||
|
has height => (is => 'rw', required => 1);
|
||
|
|
||
|
sub render($this, $container)
|
||
|
{
|
||
|
# hard coded into external URL mode
|
||
|
my $image_element = $container->image(id => $this->{id}, href => $this->{source});
|
||
|
$image_element->{width} = $this->{width} if defined($this->{width});
|
||
|
$image_element->{height} = $this->{height} if defined($this->{height});
|
||
|
return $image_element;
|
||
|
}
|
||
|
|
||
|
1;
|