Closed auroranil closed 6 years ago
This is for scenarios where canvas width is smaller than viewer width when zoom to fit has been applied.
If it is the other way around when zoom to fit has been applied, then it would be nice to vertically align the canvas to the centre or to the bottom of the viewport.
Unfortunately at this moment there isn't a method to fit and center. It requires few changes here https://github.com/chrvadala/react-svg-pan-zoom/blob/221a75a8c725f90da87b715bed305088b58b423c/src/features/zoom.js#L49-L51. Probably in the future I will implement it, but actually there isn't any plan. Sorry ;)
For fitSelection
, I realised that it should not try to "align" the canvas in any way. It's only useful for fitToViewer
function.
@chrvadala May I ask you if there is any progress in this matter?
I'll publish a new version soon, but unfortunately this improvement isn't in this milestone..
OK, thanks. Never mind, please don't forget :)
Some updates here https://github.com/chrvadala/react-svg-pan-zoom/pull/120
Feature released with 2.18
This is for scenarios where the dimensions for the viewer and the canvas are not the same (the canvas is the
rect
that has a white background by default).When clicking zoom to fit button, it fits the canvas to the left of the screen. It would be better if there is a way to align this canvas to the centre or to the right (without having to play around with bounds for fitSelectionToViewer method).