This isn't really a bug, but I think some users might get annoyed by this.
The changes I added in #512 automatically resize the tree coloring legend whenever sample/feature metadata coloring is updated. This is usually a good thing, since it means the legend will adjust to the size of its contents (so it'll get small if the tree is only colored by a few categories, and it'll expand -- up to its maximum size -- if the tree includes lots of categories).
However, a minor problem with this is that the legend is also resized when the tree coloring assignments aren't actually changed but when other things about tree coloring are changed: e.g. toggling clade collapsing, reversing the color map, adjusting the tip vs.all option for feature metadata coloring*, adjusting line width. This can get annoying if we're coloring the tree by a field, we've resized the legend, and we're adjusting other things about the tree -- because the legend will keep snapping back to its default size. This is especially noticeable in EMPire plots when the available screen space is small:
There are probably a few different ways we can handle this, but maybe the most straightforward would be something analogous to what @ElDeveloper proposed (albeit in a different context) in #526 -- where we make note of the currently selected field for tree coloring and don't call Empress.resizeLegend() from Empress.updateLegendCategorical() unless the currently selected field differs from the previously selected field.
* Note: Adjusting the legend size does actually make sense for this case -- since changing the tip vs. all thing can change the unique values shown in the legend. But for e.g. clade collapsing or color map reversing, I think it'd be better if the legend size wasn't adjusted here.
This isn't really a bug, but I think some users might get annoyed by this.
The changes I added in #512 automatically resize the tree coloring legend whenever sample/feature metadata coloring is updated. This is usually a good thing, since it means the legend will adjust to the size of its contents (so it'll get small if the tree is only colored by a few categories, and it'll expand -- up to its maximum size -- if the tree includes lots of categories).
However, a minor problem with this is that the legend is also resized when the tree coloring assignments aren't actually changed but when other things about tree coloring are changed: e.g. toggling clade collapsing, reversing the color map, adjusting the
tip
vs.all
option for feature metadata coloring*, adjusting line width. This can get annoying if we're coloring the tree by a field, we've resized the legend, and we're adjusting other things about the tree -- because the legend will keep snapping back to its default size. This is especially noticeable in EMPire plots when the available screen space is small:There are probably a few different ways we can handle this, but maybe the most straightforward would be something analogous to what @ElDeveloper proposed (albeit in a different context) in #526 -- where we make note of the currently selected field for tree coloring and don't call
Empress.resizeLegend()
fromEmpress.updateLegendCategorical()
unless the currently selected field differs from the previously selected field.* Note: Adjusting the legend size does actually make sense for this case -- since changing the
tip
vs.all
thing can change the unique values shown in the legend. But for e.g. clade collapsing or color map reversing, I think it'd be better if the legend size wasn't adjusted here.