disable right click on Blockly workspace
This commit is contained in:
		
							
								
								
									
										16
									
								
								sumorobot.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								sumorobot.js
									
									
									
									
									
								
							@@ -172,7 +172,7 @@ window.onload = function() {
 | 
			
		||||
 | 
			
		||||
    /* change to python code */
 | 
			
		||||
    Blockly.Sumorobot['controls_if'] = function(block) {
 | 
			
		||||
        // If/elseif/else condition.
 | 
			
		||||
        // if/elseif/else condition.
 | 
			
		||||
        var n = 0;
 | 
			
		||||
        var argument = Blockly.Sumorobot.valueToCode(block, 'IF' + n,
 | 
			
		||||
            Blockly.Sumorobot.ORDER_NONE) || 'False';
 | 
			
		||||
@@ -222,7 +222,7 @@ window.onload = function() {
 | 
			
		||||
 | 
			
		||||
    /* change the if block to be more cheerful */
 | 
			
		||||
    Blockly.Blocks.logic.HUE = '#44CC00';
 | 
			
		||||
    /* inject blockly */
 | 
			
		||||
    /* inject Blockly */
 | 
			
		||||
    var blocklyArea = document.getElementById('blocklyArea');
 | 
			
		||||
    var blocklyDiv = document.getElementById('blocklyDiv');
 | 
			
		||||
    workspace = Blockly.inject(blocklyDiv, {
 | 
			
		||||
@@ -238,7 +238,7 @@ window.onload = function() {
 | 
			
		||||
        toolbox: document.getElementById('toolbox')
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    /* on blockly resize */
 | 
			
		||||
    /* on Blockly resize */
 | 
			
		||||
    var onresize = function(e) {
 | 
			
		||||
        // Compute the absolute coordinates and dimensions of blocklyArea.
 | 
			
		||||
        var element = blocklyArea;
 | 
			
		||||
@@ -280,11 +280,15 @@ window.onload = function() {
 | 
			
		||||
    /* resume the blocks */
 | 
			
		||||
    Blockly.Xml.domToWorkspace(xml, workspace);
 | 
			
		||||
 | 
			
		||||
    /* on blockly code change */
 | 
			
		||||
    /* disable right click on Blockly workspace */
 | 
			
		||||
    Blockly.utils.isRightButton = function(e) {
 | 
			
		||||
        return false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /* on Blockly code change */
 | 
			
		||||
    function onCodeChanged(event) {
 | 
			
		||||
        /* if the if condition block was created */
 | 
			
		||||
        if (event.type == Blockly.Events.CREATE && event.xml.getAttributeNode("type").nodeValue == "controls_if") {
 | 
			
		||||
 | 
			
		||||
            /* remember the control_if block id */
 | 
			
		||||
            controlBlockId = event.blockId;
 | 
			
		||||
            /* automatically add the else statement input */
 | 
			
		||||
@@ -430,7 +434,7 @@ window.onload = function() {
 | 
			
		||||
        if (pythonEnabled) {
 | 
			
		||||
            /* send the code from the textarea to the SumoRobot */
 | 
			
		||||
            sumorobot.send("start:" + $("#blocklyCode").val());
 | 
			
		||||
        /* otherwise when we are in blockly mode */
 | 
			
		||||
        /* otherwise when we are in Blockly mode */
 | 
			
		||||
        } else {
 | 
			
		||||
            /* send the code from the blocks to the SumoRobot */
 | 
			
		||||
            sumorobot.send("start:" + sumocode);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user