Skip to content

Conversation

fdn
Copy link

@fdn fdn commented Dec 19, 2017

One commit fixes the project for NPM usage and the other adds very basic touch support. I've only tested it on an older iPad.

@@ -120,6 +153,9 @@ export default class SketchPad extends Component {
onMouseMove={this.onMouseMove}
onMouseOut={this.onMouseUp}
onMouseUp={this.onMouseUp}
onTouchStart={this.onTouchStart}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just pass down mouse event? like onTouchStart={this.onMouseDown} we don't need to create separate logic then in constructor

@@ -48,9 +48,13 @@ export default class SketchPad extends Component {
constructor(props) {
super(props);
this.initTool = this.initTool.bind(this);
this.useTouch = 'ontouchstart' in window;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this into getCursorPosition, so instead here it would be there like if(!!window.ontouchstart) { ... }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants