Fix bug with longpress and touch on ios

This commit is contained in:
Rachel Fenichel
2016-11-08 16:18:05 -08:00
parent 406fe8c26a
commit 80e9a5663c
2 changed files with 5 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ Blockly.BlockSvg.prototype.initSvg = function() {
Blockly.bindEventWithChecks_(this.getSvgRoot(), 'mousedown', this,
this.onMouseDown_);
var thisBlock = this;
Blockly.bindEventWithChecks_(this.getSvgRoot(), 'touchstart', null,
Blockly.bindEvent_(this.getSvgRoot(), 'touchstart', null,
function(e) {Blockly.longStart_(e, thisBlock);});
}
this.eventsInit_ = true;

View File

@@ -263,7 +263,7 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
Blockly.bindEventWithChecks_(this.svgGroup_, 'mousedown', this,
this.onMouseDown_);
var thisWorkspace = this;
Blockly.bindEventWithChecks_(this.svgGroup_, 'touchstart', null,
Blockly.bindEvent_(this.svgGroup_, 'touchstart', null,
function(e) {Blockly.longStart_(e, thisWorkspace);});
if (this.options.zoomOptions && this.options.zoomOptions.wheel) {
// Mouse-wheel.
@@ -765,6 +765,9 @@ Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) {
Blockly.onMouseMoveWrapper_ = Blockly.onMouseMoveWrapper_.concat(
Blockly.bindEventWithChecks_(document, 'mousemove', null,
Blockly.onMouseMove_));
} else {
// It was a click, but the workspace isn't draggable.
Blockly.Touch.clearTouchIdentifier();
}
// This event has been handled. No need to bubble up to the document.
e.stopPropagation();