diff --git a/core/touch.js b/core/touch.js index 885d7e7a7..362da2587 100644 --- a/core/touch.js +++ b/core/touch.js @@ -77,8 +77,15 @@ Blockly.longPid_ = 0; */ Blockly.longStart_ = function(e, uiObject) { Blockly.longStop_(); + // Punt on multitouch events. + if (e.changedTouches.length != 1) { + return; + } Blockly.longPid_ = setTimeout(function() { e.button = 2; // Simulate a right button click. + // e was a touch event. It needs to pretend to be a mouse event. + e.clientX = e.changedTouches[0].clientX; + e.clientY = e.changedTouches[0].clientY; uiObject.onMouseDown_(e); }, Blockly.LONGPRESS); }; @@ -108,7 +115,7 @@ Blockly.onMouseUp_ = function(e) { } Blockly.Touch.clearTouchIdentifier(); - // TODO(#781): Check whether this needs to be called for all drag modes. + // TODO(#781): Check whether this needs to be called for all drag modes. workspace.resetDragSurface(); Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN); workspace.dragMode_ = Blockly.DRAG_NONE;