React component to zoom and scroll an svg element
MIT License
React component to zoom and scroll an svg element.
npm install react-svg-camera --save
Change the camera prop to manipulate the svg's viewBox
.
See demo.
var SvgCamera = require('react-svg-camera');
ReactDOM.render(
<SvgCamera camera={camera}>
{/* children here */}
</SvgCamera>,
container
);
<SvgCamera>
renders <svg>
Required. Object that looks like
{
// Mid point of camera
x: 50,
// Mid point of camera
y: 100,
// Amount of zoom, 2 means zooming in by 2x. Must be > 0.
zoom: 2
}
MIT