File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ var dragEventFor = eventsFor.mouse;
8181 * get {clientX, clientY} positions of control
8282 * */
8383function getControlPosition ( e ) {
84- var position = ( e . touches && e . touches [ 0 ] ) || e ;
84+ var position = ( e . targetTouches && e . targetTouches [ 0 ] ) || e ;
8585 return {
8686 clientX : position . clientX ,
8787 clientY : position . clientY
@@ -514,6 +514,11 @@ module.exports = React.createClass({
514514 } ,
515515
516516 handleDragStart : function ( e ) {
517+ // Set touch identifier in component state if this is a touch event
518+ if ( e . targetTouches ) {
519+ this . setState ( { identifier : e . targetTouches [ 0 ] . identifier } ) ;
520+ }
521+
517522 // Make it possible to attach event handlers on top of this one
518523 this . props . onMouseDown ( e ) ;
519524
@@ -574,6 +579,10 @@ module.exports = React.createClass({
574579 } ,
575580
576581 handleDrag : function ( e ) {
582+ // Return if this is a touch event, but not the correct one for thiss element
583+ if ( e . targetTouches && ( e . targetTouches [ 0 ] . identifier != this . state . identifier ) ) {
584+ return ;
585+ }
577586 var dragPoint = getControlPosition ( e ) ;
578587
579588 // Calculate X and Y
You can’t perform that action at this time.
0 commit comments