fix control_if mutator closing on touch

This commit is contained in:
Silver Kuusik 2018-01-15 21:07:23 +01:00
parent dae8f457e1
commit 3d22d8666e
1 changed files with 11 additions and 4 deletions

View File

@ -282,10 +282,17 @@ window.onload = function() {
/* when mouse click occures on Blockly workspace */
Blockly.utils.isRightButton = function(e) {
/* if control_if block is used */
var target = e.target;
/* when control_if block is in use */
if (controlBlockId != "") {
/* close the control_if block mutator */
workspace.getBlockById(controlBlockId).mutator.setVisible(false);
/* when the user clicks anywhere outside the mutator and not on the mutator icon */
if (!$(target).is('.blocklyBubbleCanvas') && !$(target).parents().is('.blocklyBubbleCanvas')) {
if (!$(target).is('.blocklyIconGroup') && !$(target).parents().is('.blocklyIconGroup')) {
/* hide the mutator */
workspace.getBlockById(controlBlockId).mutator.setVisible(false);
}
}
}
/* disable right click on Blockly workspace */
return false;
@ -510,7 +517,7 @@ window.onload = function() {
var target = e.target;
/* when control_if block is in use */
if (controlBlockId) {
if (controlBlockId != "") {
/* when the user clicks anywhere outside the mutator and not on the mutator icon */
if (!$(target).is('.blocklyBubbleCanvas') && !$(target).parents().is('.blocklyBubbleCanvas')) {
if (!$(target).is('.blocklyIconGroup') && !$(target).parents().is('.blocklyIconGroup')) {