Skip to content

Commit

Permalink
GUI::Legend: Don't overwrite cached colour metadata
Browse files Browse the repository at this point in the history
This can otherwise cause issues later on.
  • Loading branch information
shawnlaffan committed Feb 1, 2024
1 parent e212015 commit 3565e86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Biodiverse/GUI/Legend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,12 @@ sub set_colour_mode_from_list_and_index {
my $labels = $indices_object->get_index_category_labels (index => $index) // {};
my $colours = $indices_object->get_index_category_colours (index => $index) // {};
$self->{categorical}{labels} = $labels;
# don't mess with the cached object
foreach my $key (keys %$colours) {
my $colour = $colours->{$key};
$colours->{$key} = Gtk2::Gdk::Color->parse($colour);
next if blessed $colour; # sometimes they are already colour objects
$self->{categorical}{colours}{$key} = Gtk2::Gdk::Color->parse($colour);
}
$self->{categorical}{colours} = $colours;
}
elsif (!$mode && $list =~ />>CANAPE>>/) {
# special handling for CANAPE indices
Expand Down

0 comments on commit 3565e86

Please sign in to comment.