-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to centre or right align for fit SVG to viewer #65
Comments
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 react-svg-pan-zoom/src/features/zoom.js Lines 49 to 51 in 221a75a
|
For |
@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 #120 |
* Added option to align svg while fitting it to the viewer Alignment can be passed as optional props to ReactSVGPanZoom and Toolbar components or as arguments to the base fitToViewer function. Default alignment values are provided (aligning to top left, as before). * SVG alignment props moved to toolbarProps Plus fitToViewer() changed to fitToViewer(SVGAlignX, SVGAlignY) in ReactSVGPanZoom * adds a storybook example * adds a storybook example * adds doc
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).
The text was updated successfully, but these errors were encountered: