undef $first;
}
- else
- {
- $cr->line_to( $feature->{ 'x2' }, $feature->{ 'y2' } );
- }
+
+ $cr->line_to( $feature->{ 'x1' }, $feature->{ 'y2' } );
+ $cr->line_to( $feature->{ 'x2' }, $feature->{ 'y2' } );
}
elsif ( $feature->{ 'type' } eq 'arrow' )
{
# Returns a list.
- my ( $i, $max_val, $min_val, $factor, $factor_height, $x1, $y1, $x2, $y2, @block, $mean, @features );
+ my ( $i, $max_val, $min_val, $factor, $factor_height, $x1, $y1, $x2, $y2, $block_max, $mean, @features );
$factor = $cookie->{ 'IMG_WIDTH' } / ( $end - $beg );
$factor_height = $cookie->{ 'WIGGLE_HEIGHT' } / $max_val;
}
+ $block_max = 0;
+
$x1 = 0;
$y1 = $cookie->{ 'TRACK_OFFSET' } + $cookie->{ 'WIGGLE_HEIGHT' };
for ( $i = 0; $i < scalar @{ $vals }; $i++ )
{
- push @block, $vals->[ $i ];
+ $block_max = Maasha::Calc::max( $block_max, $vals->[ $i ] );
$x2 = int( $i * $factor );
if ( $x2 > $x1 )
{
- $mean = sprintf( "%.0f", Maasha::Calc::mean( \@block ) );
-
- $y2 = $cookie->{ 'TRACK_OFFSET' } + $cookie->{ 'WIGGLE_HEIGHT' } - ( $mean * $factor_height );
+ $y2 = $cookie->{ 'TRACK_OFFSET' } + $cookie->{ 'WIGGLE_HEIGHT' } - sprintf( "%.0f", $block_max * $factor_height );
push @features, {
type => 'wiggle',
$x1 = $x2;
$y1 = $y2;
- undef @block;
+ $block_max = 0;
}
}