biocore / empress

A fast and scalable phylogenetic tree viewer for microbiome data analysis
BSD 3-Clause "New" or "Revised" License
45 stars 31 forks source link

Automatically resize main legend when changing tree coloring #512

Closed fedarko closed 3 years ago

fedarko commented 3 years ago

The main legend in the application is resizable, and its size will automatically change as the tree is colored by different categories. However, this behavior currently stops working after the user manually resizes the legend at all:

leg

We should keep the ability for users to manually resize the legend, IMO, since the legend can get really large and we don't want it to obstruct the user's view.

It looks like the reason for this is that, when the user manually resizes the legend, that the width / height attributes of the legend go from being unspecified to being fixed: (note the element.style text in the dev console on the right)

wh

This PR fixes this, by resetting the width/height of the main legend to their defaults right before we adjust tree coloring:

Peek 2021-04-30 20-53

It's worth noting that this PR will need to be updated once #484 is merged in so that Empress.resizeLegend() is called before creating a continuous legend.

emperor-helper commented 3 years ago

The following artifacts were built for this PR: empire-biplot.qzv, empire.qzv, empress-tree.qzv, just-fm.qzv, plain.qzv

kwcantrell commented 3 years ago

Thanks @fedarko, this looks good! I will go ahead and merge this and update #484.