| 1 | use Renard::Incunabula::Common::Setup; | ||
| 2 | package Intertangle::Jacquard::Role::Render::QnD::Bounds::Group; | ||
| 3 | # ABSTRACT: Quick-and-dirty group bounds | ||
| 4 | $Intertangle::Jacquard::Role::Render::QnD::Bounds::Group::VERSION = '0.001'; | ||
| 5 | use Moo::Role; | ||
| 6 | use Intertangle::Yarn::Graphene; | ||
| 7 | use Intertangle::Yarn::Types qw(Point Size); | ||
| 8 | |||
| 9 | method bounds() { | ||
| 10 | my $rect = Intertangle::Yarn::Graphene::Rect->new( | ||
| 11 | origin => $self->children->[0]->origin_point, | ||
| 12 | size => $self->children->[0]->size, | ||
| 13 | ); | ||
| 14 | for my $child (@{ $self->children }) { | ||
| 15 | $rect = $rect->union( $child->bounds ); | ||
| 16 | } | ||
| 17 | |||
| 18 | $rect; | ||
| 19 | } | ||
| 20 | |||
| 21 | 1; | ||
| 22 | |||
| 23 | __END__ | ||
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =encoding UTF-8 | ||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | Intertangle::Jacquard::Role::Render::QnD::Bounds::Group - Quick-and-dirty group bounds | ||
| 32 | |||
| 33 | =head1 VERSION | ||
| 34 | |||
| 35 | version 0.001 | ||
| 36 | |||
| 37 | =head1 METHODS | ||
| 38 | |||
| 39 | =head2 bounds | ||
| 40 | |||
| 41 | ... | ||
| 42 | |||
| 43 | =head1 AUTHOR | ||
| 44 | |||
| 45 | Zakariyya Mughal <zmughal@cpan.org> | ||
| 46 | |||
| 47 | =head1 COPYRIGHT AND LICENSE | ||
| 48 | |||
| 49 | This software is copyright (c) 2017 by Zakariyya Mughal. | ||
| 50 | |||
| 51 | This is free software; you can redistribute it and/or modify it under | ||
| 52 | the same terms as the Perl 5 programming language system itself. | ||
| 53 | |||
| 54 | =cut |