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

View File

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