diff --git a/core/block_svg.js b/core/block_svg.js index ec1497677..9a7f87596 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -533,7 +533,11 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) { } if (this.isInFlyout) { // longStart's simulation of right-clicks for longpresses on touch devices - // calls the object's onMouseDown, instead of the flyout's onMouseDown. + // calls the onMouseDown_ function defined on the prototype of the object + // the was longpressed (in this case, a Blockly.BlockSvg). In this case + // that behaviour is wrong, because Blockly.Flyout.prototype.blockMouseDown + // should be called for a mousedown on a block in the flyout, which blocks + // execution of the block's onMouseDown_ function. if (e.type == 'touchstart' && Blockly.isRightButton(e)) { Blockly.Flyout.blockRightClick_(e, this); e.stopPropagation(); diff --git a/core/touch.js b/core/touch.js index 8f06c990f..93587dbc9 100644 --- a/core/touch.js +++ b/core/touch.js @@ -187,19 +187,10 @@ Blockly.Touch.shouldHandleEvent = function(e) { * saved identifier. */ Blockly.Touch.checkTouchIdentifier = function(e) { - var identifier; - // TODO (fenichel): Improve splitEventByTouches to get rid of this try/catch. - try { - identifier = (e.changedTouches && e.changedTouches.item(0) && - e.changedTouches.item(0).identifier != undefined && - e.changedTouches.item(0).identifier != null) ? - e.changedTouches.item(0).identifier : 'mouse'; - } catch (ex) { - identifier = (e.changedTouches && e.changedTouches[0] && + var identifier = (e.changedTouches && e.changedTouches[0] && e.changedTouches[0].identifier != undefined && e.changedTouches[0].identifier != null) ? e.changedTouches[0].identifier : 'mouse'; - } // if (Blockly.touchIdentifier_ )is insufficient because android touch // identifiers may be zero. diff --git a/core/utils.js b/core/utils.js index 6886a7d24..e3e392303 100644 --- a/core/utils.js +++ b/core/utils.js @@ -96,6 +96,9 @@ Blockly.hasClass_ = function(element, className) { * @param {string} name Event name to listen to (e.g. 'mousedown'). * @param {Object} thisObject The value of 'this' in the function. * @param {!Function} func Function to call when event is triggered. + * @param {boolean} opt_noCaptureIdentifier True if triggering on this event + * should not block execution of other event handlers on this touch or other + * simultaneous touches. * @return {!Array.} Opaque data that can be passed to unbindEvent_. * @private */