diff --git a/core/tooltip.js b/core/tooltip.js index 2ff612b7b..7ee2a7080 100644 --- a/core/tooltip.js +++ b/core/tooltip.js @@ -133,7 +133,11 @@ Blockly.Tooltip.createDom = function() { Blockly.Tooltip.bindMouseEvents = function(element) { Blockly.bindEvent_(element, 'mouseover', null, Blockly.Tooltip.onMouseOver_); Blockly.bindEvent_(element, 'mouseout', null, Blockly.Tooltip.onMouseOut_); - Blockly.bindEvent_(element, 'mousemove', null, Blockly.Tooltip.onMouseMove_); + + // Don't use bindEvent_ for mousemove since that would create a + // corresponding touch handler, even though this only makes sense in the + // context of a mouseover/mouseout. + element.addEventListener('mousemove', Blockly.Tooltip.onMouseMove_, false); }; /** diff --git a/core/utils.js b/core/utils.js index 045566057..a59b6250a 100644 --- a/core/utils.js +++ b/core/utils.js @@ -100,6 +100,7 @@ Blockly.hasClass_ = function(element, className) { */ Blockly.bindEvent_ = function(node, name, thisObject, func, opt_noCaptureIdentifier) { + var handled = false; var wrapFunc = function(e) { var captureIdentifier = !opt_noCaptureIdentifier; // Handle each touch point separately. If the event was a mouse event, this @@ -107,7 +108,7 @@ Blockly.bindEvent_ = function(node, name, thisObject, func, var events = Blockly.bindEvent_.splitEventByTouches(e); for (var i = 0, event; event = events[i]; i++) { if (captureIdentifier && !Blockly.shouldHandleEvent(event)) { - return; + continue; } Blockly.bindEvent_.setClientFromTouch(event); if (thisObject) { @@ -115,6 +116,7 @@ Blockly.bindEvent_ = function(node, name, thisObject, func, } else { func(event); } + handled = true; } }; @@ -126,7 +128,9 @@ Blockly.bindEvent_ = function(node, name, thisObject, func, var touchWrapFunc = function(e) { wrapFunc(e); // Stop the browser from scrolling/zooming the page. - e.preventDefault(); + if (handled) { + e.preventDefault(); + } }; for (var i = 0, eventName; eventName = Blockly.bindEvent_.TOUCH_MAP[name][i]; i++) { diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 1997886f0..36180ac93 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -647,7 +647,8 @@ Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) { */ Blockly.WorkspaceSvg.prototype.createVariable = function(name) { Blockly.WorkspaceSvg.superClass_.createVariable.call(this, name); - if (this.toolbox_ && this.toolbox_.flyout_) { + // Don't refresh the toolbox if there's a drag in progress. + if (this.toolbox_ && this.toolbox_.flyout_ && !Blockly.Flyout.startFlyout_) { this.toolbox_.refreshSelection(); } };