Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ooade committed Feb 7, 2019
1 parent e966a71 commit ec47a2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const options = {

render(
<ReactRough width={220} height={220}>
<ReactRough.Rectangle options={options} />
<Rectangle options={options} />
</ReactRough>
);
```
Expand All @@ -47,8 +47,8 @@ import { ReactRough, Rectangle, Circle } from 'react-rough';

render(
<ReactRough width={200} height={400}>
<ReactRough.Circle points={[50, 50, 80]} fill="red" />
<ReactRough.Polygon
<Circle points={[50, 50, 80]} fill="red" />
<Polygon
points={[[[690, 130], [790, 140], [750, 240], [690, 220]]]}
fill="blue"
stroke="green"
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ export const Line = props => <RoughConsumer type="line" {...props} />;

export const Path = props => <RoughConsumer type="path" {...props} />;

export const LinearPath = props => <RoughConsumer type="linearPath" {...props} />;
export const LinearPath = props => (
<RoughConsumer type="linearPath" {...props} />
);

export const Polygon = props => <RoughConsumer type="polygon" {...props} />;


export const Rectangle = props => <RoughConsumer type="rectangle" {...props} />;

class ReactRough extends React.Component {
Expand All @@ -89,15 +90,14 @@ class ReactRough extends React.Component {
this.rc = Rough.canvas(this.canvasRef.current);
// Force a render now that we have the canvas
this.forceUpdate();

}

clearCanvas() {
const { backgroundColor, width, height } = this.props;
// If this is the first render the ctx will be null
// It will be cleared later on componentDidMount
if (!this.ctx) {
return
return;
}

if (backgroundColor) {
Expand Down

0 comments on commit ec47a2a

Please sign in to comment.