Skip to content
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

Responsive Display with ReactSVGPanZoom #204

Open
KhRania opened this issue May 6, 2021 · 2 comments
Open

Responsive Display with ReactSVGPanZoom #204

KhRania opened this issue May 6, 2021 · 2 comments

Comments

@KhRania
Copy link

KhRania commented May 6, 2021

Hello, I'm working with ReactSVGPanZoom and i want to make the display responsive (for mobile and laptop)
I'm using fitToViewer to set the display width and height.
any help please ?
Thanks!

@nikonikoniko
Copy link

I would also be interested in a solution for this.

It seems that fitToViewer only works when the component height and width is set to a px value and not a percentage.

for example:

      <UncontrolledReactSVGPanZoom
        ref={vieweRef}
        width={"100%"} height={"100%"}
        tool="auto" />

causes fitToViewer() to throw an error.

@leoncraggs
Copy link

leoncraggs commented Jul 9, 2021

Try -> https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md

      <AutoSizer>
        {({ width, height }) =>(
         <ReactSVGPanZoom
                width={width}
                height={height}
                ...
          >
                 <svg viewBox={`0 0 ${width} ${height}`}></svg>
        </ReactSVGPanZoom>
        )}
     </AutoSizer>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants