App-Asciio
view release on metacpan or search on metacpan
#register_action_handlers return own data not the evaled package
#script to generate a list of the actions available
#error: |------------>
#error: moving connectors on each other bugs the connector size
only when end connector is backed over start connector
#error: multi wirl inter-sections overlays should be taken from the arrow definition
# .####
| #
#####-##
#direction change should work on any arrow section
#error: Add section keeps connection
#error: Add section doesn't connect
# multi wirl extension as if we were drawing the arrow
lib/App/Asciio/stripes/section_wirl_arrow.pm view on Meta::CPAN
['upright', '|', '|', '.', '-', '>', 1],
['rightup', '-', '-', '\'', '|', '^', 1],
['downright', '|', '|', '\'', '-', '>', 1],
['rightdown', '-', '-', '.', '|', 'v', 1],
['45', '/', '/', '', '', '^', 1, ],
['135', '\\', '\\', '', '', 'v', 1, ],
['225', '/', '/', '', '', 'v', 1, ],
['315', '\\', '\\', '', '', '^', 1, ],
] ;
# constants for connector overlays
Readonly my $body_index => 2 ;
Readonly my $connection_index => 3 ;
Readonly my $up_index=> 1 ;
Readonly my $left_index=> 3 ;
Readonly my $leftup_index => 5 ;
Readonly my $leftdown_index => 7 ;
sub new
{
lib/App/Asciio/stripes/section_wirl_arrow.pm view on Meta::CPAN
) ;
}
else
{
die "Bad 'section wirl arrow' defintion! Expecting points array." ;
}
}
#-----------------------------------------------------------------------------
my %diagonal_direction_to_overlay_character =
(
(map {$_ => q{\\}} qw( down-right right-down up-left left-up)),
(map {$_ => q{/}} qw( down-left left-down up-right right-up)),
) ;
my %diagonal_non_diagonal_to_overlay_character =
(
(map {$_ => q{.}} qw( down-right right-down up-left left-up)),
(map {$_ => q{'}} qw( down-left left-down up-right right-up)),
) ;
sub get_mask_and_element_stripes
{
my ($self) = @_ ;
my @mask_and_element_stripes ;
lib/App/Asciio/stripes/section_wirl_arrow.pm view on Meta::CPAN
$previous_was_diagonal
&&
(
$previous_was_diagonal eq $arrow->{DIRECTION}
||
(defined $d2 && $previous_was_diagonal eq "$d2-$d1")
)
)
{
# two diagonals going in the same direction
$connection = $diagonal_direction_to_overlay_character{$arrow->{DIRECTION}} ;
}
else
{
# previous non diagonal or two diagonals not going in the same direction
$connection = ($d1 eq 'up' || (defined $d2 && $d2 eq 'up')) ? q{'} : q{.} ;
}
$previous_was_diagonal = $arrow->{DIRECTION} ;
}
else
lib/App/Asciio/stripes/section_wirl_arrow.pm view on Meta::CPAN
}
}
}
$previous_direction = defined $d2 ? $d2 : $d1 ;
$previous_was_diagonal = undef ;
}
if($arrow_index != 0 && defined $connection) # first character of the first section is always right
{
# overlay the first character of this arrow
push @mask_and_element_stripes,
{
X_OFFSET => $self->{POINTS_OFFSETS}[$arrow_index][0],
Y_OFFSET => $self->{POINTS_OFFSETS}[$arrow_index][1],
WIDTH => 1,
HEIGHT => 1,
TEXT => $connection,
} ;
}
( run in 0.512 second using v1.01-cache-2.11-cpan-49f99fa48dc )