Skip to content

Commit

Permalink
Replace legacy string ref, allow className to be overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
nhunzaker committed May 29, 2018
1 parent 0ee5e79 commit beb0ee6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 6.3.0

- Replace legacy string refs
- Allow className to be overriden

## 6.2.0

Expand Down
13 changes: 9 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let Equations = require('./util/equations')
class Ink extends React.PureComponent {
static defaultProps = {
background: true,
className: 'ink',
duration: 1000,
opacity: 0.25,
radius: 150,
Expand Down Expand Up @@ -98,7 +99,7 @@ class Ink extends React.PureComponent {
}

pushBlot(timeStamp, clientX, clientY) {
let el = this.refs.canvas
let el = this.canvas

// 0.13 support
if (el instanceof window.HTMLCanvasElement === false) {
Expand Down Expand Up @@ -126,13 +127,17 @@ class Ink extends React.PureComponent {
})
}

setCanvas(el) {
this.canvas = el
}

render() {
let { density, height, width, touchEvents } = this.state
let { className, density, height, width, touchEvents } = this.state

return (
<canvas
className="ink"
ref="canvas"
className={className}
ref={this.setCanvas.bind(this)}
style={{ ...STYLE, ...this.props.style }}
height={height * density}
width={width * density}
Expand Down

0 comments on commit beb0ee6

Please sign in to comment.