Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
react-svg-pan-zoom
Advanced tools
A react component that adds pan and zoom features to SVG
npm install --save react-svg-pan-zoom
import React from 'react';
import ReactDOM from 'react-dom';
import {Viewer, ViewerHelper, TOOL_NONE, TOOL_PAN, TOOL_ZOOM} from 'react-svg-pan-zoom';
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
value: ViewerHelper.getDefaultValue(),
tool: TOOL_PAN //you can change this state with TOOL_NONE or TOOL_ZOOM
};
}
handleChange(event) {
this.setState({value: event.value});
}
render() {
return (
<div>
<Viewer viewerWidth={400} viewerHeight={400} artboardWidth={800} artboardHeight={800}
value={this.state.value} onChange={event => this.handleChange(event)}
tool={this.state.tool}>
<rect x="30" y="50" width="100" height="70" fill="black"/>
<circle cx="210" cy="120" r="50" fill="blue"/>
</Viewer>
</div>
);
}
}
viewer
- <div>
that contains a part of drawingartboard
- canvas that contains the drawingviewerWidth
– required – width of the viewer displayed on screenviewerHeight
– required – height of the viewer displayed on screenviewerBackground
– background of the viewerartboardWidth
– required – width of the artboard (size of the original vector image)artboardHeight
– required – height of the artboard (size of the original vector image)artboardBackground
- background of the artboardvalue
- value of the viewer (current point of view)style
- CSS style of the SVG tagonChange
- handler something changedonClick
- handler clickonMouseMove
- handler mousemovetool
- current active tool (TOOL_NONE
, TOOL_PAN
, TOOL_ZOOM
)FAQs
A React component that adds pan and zoom features to SVG
The npm package react-svg-pan-zoom receives a total of 61,506 weekly downloads. As such, react-svg-pan-zoom popularity was classified as popular.
We found that react-svg-pan-zoom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.