parent
c93297d845
commit
a758dabcf2
@ -0,0 +1,27 @@ |
|||||||
|
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; |
Loading…
Reference in new issue