This is not obvious from the documentation (if you can call README.md
documentation ;) ), but the svg-pan-zoom library probably supports (only) vertical/horizontal fit, though how? Best fit is already supported through fit
method and works fine.
The method called contain
is probably the one to use, yet when I call it sometimes it does one and sometimes the other.
I know I can probably do this myself and/or contribute to this nice OSS, just checking if the support is already there.