Skip to content

Commit

Permalink
GUI legend: add set_log_mode method with boolean argument
Browse files Browse the repository at this point in the history
Simplifies some calling code.
  • Loading branch information
shawnlaffan committed Dec 30, 2023
1 parent 0702f94 commit f538103
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/Biodiverse/GUI/Legend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,13 @@ sub set_text_marks_for_labels {
return;
}

sub set_log_mode {
croak "boolean arg not passed"
if @_ < 2;
my ($self, $bool) = @_;

return $self->{log_mode} = $bool ? 1 : 0;
}

sub set_log_mode_on {
my ($self) = @_;
Expand Down
7 changes: 1 addition & 6 deletions lib/Biodiverse/GUI/Tabs/Spatial.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1690,12 +1690,7 @@ sub colour_branches_on_dendrogram {
);

my $log_check_box = $self->{xmlPage}->get_object('menuitem_spatial_tree_log_scale');
if ($log_check_box->get_active) {
$legend->set_log_mode_on;
}
else {
$legend->set_log_mode_off;
}
$legend->set_log_mode($log_check_box->get_active);

my $flip_check_box = $self->{xmlPage}->get_object('menuitem_spatial_tree_colour_stretch_flip_mode');
$legend->set_invert_colours ($flip_check_box->get_active);
Expand Down

0 comments on commit f538103

Please sign in to comment.