Skip to content

Commit

Permalink
fix floating subtrack labels so that they never go off left edge
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein committed Feb 8, 2012
1 parent b7ab93a commit 79d7d3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Bio/Graphics/Browser2/RenderPanels.pm
Expand Up @@ -382,7 +382,7 @@ sub render_tracks {
my $height = $data->height; my $height = $data->height;
my $url = $self->source->generate_image($gd); my $url = $self->source->generate_image($gd);


# for debugging # for debugging
my $status = $data->status; my $status = $data->status;


$result{$label} = $self->wrap_rendered_track( $result{$label} = $self->wrap_rendered_track(
Expand Down Expand Up @@ -699,6 +699,7 @@ sub wrap_rendered_track {
my $subtrack_labels = join '',map { my $subtrack_labels = join '',map {
my ($label,$left,$top,undef,undef,$color) = @$_; my ($label,$left,$top,undef,undef,$color) = @$_;
$left -= $source->global_setting('pad_left') + PAD_DETAIL_SIDES; $left -= $source->global_setting('pad_left') + PAD_DETAIL_SIDES;
$left = 3 if $left < 3;
my ($r,$g,$b,$a) = $color =~ /rgba\((\d+),(\d+),(\d+),([\d.]+)/; my ($r,$g,$b,$a) = $color =~ /rgba\((\d+),(\d+),(\d+),([\d.]+)/;
$a = 0.60 if $a > 0.75; $a = 0.60 if $a > 0.75;
my $fgcolor = $a <= 0.5 ? 'black' : ($r+$g+$b)/3 > 128 ? 'black' : 'white'; my $fgcolor = $a <= 0.5 ? 'black' : ($r+$g+$b)/3 > 128 ? 'black' : 'white';
Expand Down Expand Up @@ -1667,6 +1668,8 @@ sub subtrack_select_filter {
return $stt->filter_feature_sub; return $stt->filter_feature_sub;
} }



# this routine is too long and needs to be modularized
sub add_features_to_track { sub add_features_to_track {
my $self = shift; my $self = shift;
my %args = @_; my %args = @_;
Expand Down Expand Up @@ -1881,7 +1884,8 @@ sub add_features_to_track {
if $limit && $limit > 0; if $limit && $limit > 0;


# essentially make label invisible if we are going to get the label position # essentially make label invisible if we are going to get the label position
$tracks->{$l}->configure(-fontcolor => 'white:0.0') if $tracks->{$l}->parts->[0]->record_label_positions; $tracks->{$l}->configure(-fontcolor => 'white:0.0')
if $tracks->{$l}->parts->[0]->record_label_positions;


if (eval{$tracks->{$l}->features_clipped}) { # may not be present in older Bio::Graphics if (eval{$tracks->{$l}->features_clipped}) { # may not be present in older Bio::Graphics
my $max = $tracks->{$l}->feature_limit; my $max = $tracks->{$l}->feature_limit;
Expand Down

0 comments on commit 79d7d3a

Please sign in to comment.