mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
Fix bug with longpress and touch on ios
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user