diff --git a/lib/EventTypes.js b/lib/EventTypes.js index d88bc0e..8bf41f7 100644 --- a/lib/EventTypes.js +++ b/lib/EventTypes.js @@ -7,5 +7,8 @@ module.exports = { onTouchMove: 'touchmove', onTouchEnd: 'touchend', onTouchCancel: 'touchcancel', + onMouseDown: 'mousedown', + onMouseMove: 'mousemove', + onMouseUp: 'mouseup', onClick: 'click' }; diff --git a/lib/Surface.js b/lib/Surface.js index f7a1ca4..f6e66b3 100644 --- a/lib/Surface.js +++ b/lib/Surface.js @@ -106,6 +106,9 @@ var Surface = React.createClass({ onTouchMove: this.handleTouchMove, onTouchEnd: this.handleTouchEnd, onTouchCancel: this.handleTouchEnd, + onMouseDown: this.handleMouseDown, + onMouseMove: this.handleMouseMove, + onMouseUp: this.handleMouseUp, onClick: this.handleClick}) ); }, @@ -212,6 +215,21 @@ var Surface = React.createClass({ handleClick: function (e) { this.hitTest(e); + }, + + handleMouseDown: function(e) { + var hitTarget = hitTest(e, this.node, this.getDOMNode()); + if (hitTarget) { + hitTarget[hitTest.getHitHandle(e.type)](e); + } + }, + + handleMouseMove: function(e) { + this.hitTest(e); + }, + + handleMouseUp: function(e) { + this.hitTest(e); } });