Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
react-sketch-3.0
Advanced tools
Sketch Element for React based applications, backed-up by fabricjs as its core
A Sketch tool for React based applications, backed-up by FabricJS
This tool is based on react-sketch and react-sketch2. I've modified it to fix some bugs.
Please note that this module is still in development! Feel free to send me enhancements and ideas :)
npm install react-sketch-3.0 --save
In order to build from source, read the relevant instructions first.
Tested with node versions 6,7,8.
Import the relevant SketchField component and use it, you can find more on the examples folder of the project
import {SketchField, Tools} from 'react-sketch';
class SketchFieldDemo extends React.Component {
render() {
return (
<SketchField width='1024px'
height='768px'
tool={Tools.Pencil}
lineColor='black'
lineWidth={3}/>
)
}
}
Configuration Options
Option | Type | Default | Description |
---|---|---|---|
tool | Enumeration (string) | pencil | The tool to use, can be select, pencil, circle, rectangle, pan |
lineColor | String | black | The color of the line |
lineWidth | Number | 1 | The width of the line |
fillColor | String | transparent | The fill color (hex format) of the shape when applicable (e.g. circle) |
backgroundColor | String | transparent | The the background color of the sketch in hex or rgba |
undoSteps | Number | 15 | number of undo/redo steps to maintain |
imageFormat | String | png | image format when calling toDataURL, can be png or jpeg |
width | Number | No Value(null) | Set/control the canvas width, if left empty the sketch will scale to parent element |
height | Number | 512 | Set/control the canvas height, if left empty the sketch will take a reasonable default height |
value | JSON | Property to utilize and handle the sketch data as controlled component | |
defaultValue | JSON | Default initial data, to load. If value is set then value will be loaded instead | |
widthCorrection | Number | 2 | Specify some width correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
heightCorrection | Number | 0 | Specify some height correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
Available tools
Tool | Description |
---|---|
Pencil | Free drawing pencil |
Line | Gives you the ability to draw lines |
Rectangle | Create rectangles |
Circle | Create circles |
Rectangle | Create Rectangles |
Select | Disables drawing and gives you the ability to modify existing elements in the canvas |
Pan | Disables drawing and gives you the ability to move the complete canvas at will, useful to adjust the canvas when zooming in or out (thank you wmaillard) |
The project includes a webpack server for running the examples, just run:
git clone https://github.com/tbolis/react-sketch.git
yarn install
npm start
and navigate to http://localhost:23000
You can as well check the live showcase here: http://tbolis.github.io/showcase/react-sketch/
See https://github.com/tbolis/react-sketch/issues
See https://github.com/tbolis/react-sketch/blob/master/CHANGELOG.md
MIT, do remember to add a reference if you find it useful :)
FAQs
Sketch Element for React based applications, backed-up by fabricjs as its core
The npm package react-sketch-3.0 receives a total of 42 weekly downloads. As such, react-sketch-3.0 popularity was classified as not popular.
We found that react-sketch-3.0 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.