| 1 | use Renard::Incunabula::Common::Setup; | ||
| 2 | package Intertangle::Jacquard::Actor::Role::Layoutable; | ||
| 3 | # ABSTRACT: A role for actors that can layout their children | ||
| 4 | $Intertangle::Jacquard::Actor::Role::Layoutable::VERSION = '0.002'; | ||
| 5 | use Moo::Role; | ||
| 6 | |||
| 7 | with qw(Intertangle::Jacquard::Actor::Role::Tree::TreeDAGNode::WithChildren); | ||
| 8 | |||
| 9 | has layout => ( | ||
| 10 | is => 'ro', | ||
| 11 | predicate => 1, | ||
| 12 | ); | ||
| 13 | |||
| 14 | after add_child => method( $actor, %options ) { | ||
| 15 | if( $self->has_layout ) { | ||
| 16 | $self->layout->add_actor( $actor, | ||
| 17 | exists $options{layout} ? %{ $options{layout} } : () | ||
| 18 | ); | ||
| 19 | } | ||
| 20 | }; | ||
| 21 | |||
| 22 | 1; | ||
| 23 | |||
| 24 | __END__ |