veg / phylotree.js

Interactive viewer of phylogenetic trees
http://phylotree.hyphy.org
MIT License
168 stars 72 forks source link

SVG size not updated on zoom #400

Open 524D opened 2 years ago

524D commented 2 years ago

When zoom is enabled, the tree size can be zoomed but the picture remains clipped to the original limits. This is probably because the size of the SVG container is not updated. Updating the container size would make zooming much more useful. I have tested this by setting 'zoom': true in the phylotree.hyphy.org sample.

stevenweaver commented 2 years ago

Hi @524D,

Most examples of d3.zoom do not increase the container size. This behavior could prove erratic on fixed-width websites. Have you considered using your operating system's zoom feature?

Best, Steven

524D commented 2 years ago

Hi @stevenweaver ,

Thanks for your answer!

I'm not competent in D3 programming so I don't know how zooming works there. However, on a fixed-width website I think a user would expect that scroll bars pop up when zooming beyond the available size (e.g. by embedding the SVG in an "overflow=auto" style block element).

I'm using Phylotree in an electron app, where the tree is shown as part of a normal desktop application. Sometimes the trees in this app only have 6 leaves, those small trees just look nicer and can be examined better when zooming in. If there is another way to increase the size that would also help of course. Currently, without zooming, the tree is displayed quite small (left-right-spacing/top-bottom-spacing="fixed-step") or very spread-out with thin edges and small fonts (*-spacing = "fit-to-size").

Zooming in this case is not meant for accessibility/poor vision, so I don't think the OS zoom feature is something many users would want to use.

Best, Rob