scratch-blocks 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly_compressed_horizontal.js +30 -17
- package/blockly_compressed_vertical.js +42 -23
- package/blockly_uncompressed_horizontal.js +2 -2
- package/blockly_uncompressed_vertical.js +2 -2
- package/blocks_compressed.js +1 -1
- package/blocks_compressed_horizontal.js +1 -1
- package/blocks_compressed_vertical.js +1 -1
- package/core/block_render_svg_horizontal.js +8 -7
- package/core/block_render_svg_vertical.js +117 -15
- package/core/block_svg.js +256 -5
- package/core/blockly.js +34 -0
- package/core/constants.js +9 -0
- package/dist/horizontal.js +3 -3
- package/dist/vertical.js +3 -3
- package/dist/web/horizontal.js +3 -3
- package/dist/web/vertical.js +3 -3
- package/package.json +1 -1
|
@@ -657,7 +657,7 @@ d;return{connection:c,radius:g}};Blockly.ConnectionDB.init=function(a){var b=[];
|
|
|
657
657
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
658
658
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.Categories={motion:"motion",looks:"looks",sound:"sounds",pen:"pen",data:"data",dataLists:"data-lists",event:"events",control:"control",sensing:"sensing",operators:"operators",more:"more"};Blockly.DELETE_AREA_NONE=null;
|
|
659
659
|
Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.NEW_BROADCAST_MESSAGE_ID="NEW_BROADCAST_MESSAGE_ID";Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE="broadcast_msg";Blockly.LIST_VARIABLE_TYPE="list";Blockly.SCALAR_VARIABLE_TYPE="";Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE="procedures_definition";
|
|
660
|
-
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Variables={};Blockly.Variables.NAME_TYPE=Blockly.VARIABLE_CATEGORY_NAME;Blockly.Variables.CLOUD_PREFIX="\u2601 ";
|
|
660
|
+
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Themes={CLASSIC:"classic",CAT_BLOCKS:"catblocks"};Blockly.Variables={};Blockly.Variables.NAME_TYPE=Blockly.VARIABLE_CATEGORY_NAME;Blockly.Variables.CLOUD_PREFIX="\u2601 ";
|
|
661
661
|
Blockly.Variables.allUsedVariables=function(a){if(a instanceof Blockly.Block)var b=a.getDescendants(!1);else if(a instanceof Blockly.Workspace||a instanceof Blockly.WorkspaceSvg)b=a.getAllBlocks();else throw"Not Block or Workspace: "+a;var c=Blockly.Variables.noVariableText();a=Object.create(null);for(var d=0;d<b.length;d++){var e=b[d].getVarModels();if(e)for(var f=0;f<e.length;f++){var g=e[f];g.getId()&&g.name.toLowerCase()!=c&&(a[g.name.toLowerCase()]=g.name)}}b=[];for(var h in a)b.push(a[h]);return b};
|
|
662
662
|
Blockly.Variables.allVariables=function(a){return a instanceof Blockly.Block?(console.warn("Deprecated call to Blockly.Variables.allVariables with a block instead of a workspace. You may want Blockly.Variables.allUsedVariables"),{}):a.getAllVariables()};Blockly.Variables.allDeveloperVariables=function(a){var b=a.getAllBlocks();a={};for(var c=0;c<b.length;c++){var d=b[c];if(d.getDeveloperVars){d=d.getDeveloperVars();for(var e=0;e<d.length;e++)a[d[e]]=d[e]}}b=[];for(var f in a)b.push(a[f]);return b};
|
|
663
663
|
Blockly.Variables.noVariableText=function(){return"No variable selected"};Blockly.Variables.generateUniqueName=function(a){a=a.getAllVariables();var b="";if(a.length)for(var c=1,d=0,e="ijkmnopqrstuvwxyzabcdefgh".charAt(d);!b;){for(var f=!1,g=0;g<a.length;g++)if(a[g].name.toLowerCase()==e){f=!0;break}f?(d++,25==d&&(d=0,c++),e="ijkmnopqrstuvwxyzabcdefgh".charAt(d),1<c&&(e+=c)):b=e}else b="i";return b};
|
|
@@ -1449,13 +1449,26 @@ goog.Promise.setUnhandledRejectionHandler=function(a){goog.Promise.handleRejecti
|
|
|
1449
1449
|
goog.Timer.prototype.setInterval=function(a){this.interval_=a;this.timer_&&this.enabled?(this.stop(),this.start()):this.timer_&&this.stop()};goog.Timer.prototype.tick_=function(){if(this.enabled){var a=goog.now()-this.last_;0<a&&a<this.interval_*goog.Timer.intervalScale?this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_-a):(this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null),this.dispatchTick(),this.enabled&&(this.stop(),this.start()))}};
|
|
1450
1450
|
goog.Timer.prototype.dispatchTick=function(){this.dispatchEvent(goog.Timer.TICK)};goog.Timer.prototype.start=function(){this.enabled=!0;this.timer_||(this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now())};goog.Timer.prototype.stop=function(){this.enabled=!1;this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null)};goog.Timer.prototype.disposeInternal=function(){goog.Timer.superClass_.disposeInternal.call(this);this.stop();delete this.timerObject_};
|
|
1451
1451
|
goog.Timer.TICK="tick";goog.Timer.callOnce=function(a,b,c){if(goog.isFunction(a))c&&(a=goog.bind(a,c));else if(a&&"function"==typeof a.handleEvent)a=goog.bind(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(b)>goog.Timer.MAX_TIMEOUT_?goog.Timer.INVALID_TIMEOUT_ID_:goog.Timer.defaultTimerObject.setTimeout(a,b||0)};goog.Timer.clear=function(a){goog.Timer.defaultTimerObject.clearTimeout(a)};
|
|
1452
|
-
goog.Timer.promise=function(a,b){var c=null;return(new goog.Promise(function(d,e){c=goog.Timer.callOnce(function(){d(b)},a);c==goog.Timer.INVALID_TIMEOUT_ID_&&e(Error("Failed to schedule timer."))})).thenCatch(function(a){goog.Timer.clear(c);throw a;})};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.createSvgElement("g",{},null);this.svgPath_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.
|
|
1452
|
+
goog.Timer.promise=function(a,b){var c=null;return(new goog.Promise(function(d,e){c=goog.Timer.callOnce(function(){d(b)},a);c==goog.Timer.INVALID_TIMEOUT_ID_&&e(Error("Failed to schedule timer."))})).thenCatch(function(a){goog.Timer.clear(c);throw a;})};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.createSvgElement("g",{},null);Blockly.theme===Blockly.Themes.CAT_BLOCKS?(this.svgPath_=Blockly.utils.createSvgElement("g",{},this.svgGroup_),this.svgPathBody_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.svgPath_),this.svgFace_=Blockly.utils.createSvgElement("g",{},this.svgPath_),this.svgGroup_.svgPath=this.svgPath_,this.svgPath_.svgFace=this.svgFace_,this.svgPath_.svgBody=this.svgPathBody_,
|
|
1453
|
+
this.lastCallTime=0,this.CALL_FREQUENCY_MS=60,this.svgPathBody_.tooltip=this):(this.svgPath_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.svgGroup_),this.svgPath_.tooltip=this);this.rendered=!1;this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.Tooltip.bindMouseEvents(this.blockFrameElement_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c);this.svgGroup_.dataset&&(this.svgGroup_.dataset.id=this.id)};
|
|
1453
1454
|
goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.insertionMarkerMinWidth_=0;Blockly.BlockSvg.prototype.opacity_=1;Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.isGlowingBlock_=!1;Blockly.BlockSvg.prototype.isGlowingStack_=!1;Blockly.BlockSvg.INLINE=-1;
|
|
1454
|
-
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(
|
|
1455
|
-
this.
|
|
1456
|
-
Blockly.BlockSvg.prototype.
|
|
1457
|
-
Blockly.BlockSvg.prototype.
|
|
1458
|
-
Blockly.BlockSvg.prototype.
|
|
1455
|
+
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(this.isInsertionMarker())this.svgPathBody_&&this.svgPathBody_.setAttribute("stroke-opacity","0");else{for(var a=0,b;b=this.inputList[a];a++)b.init(),b.initOutlinePath(this.svgGroup_);b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon()}this.updateColour();this.updateMovable();this.workspace.options.readOnly||this.eventsInit_||Blockly.bindEventWithChecks_(this.getSvgRoot(),"mousedown",
|
|
1456
|
+
this,this.onMouseDown_);this.eventsInit_=!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};Object.defineProperty(Blockly.BlockSvg.prototype,"blockFrameElement_",{get:function(){return Blockly.theme===Blockly.Themes.CAT_BLOCKS?this.svgPathBody_:this.svgPath_},enumerable:!0,configurable:!0});
|
|
1457
|
+
Blockly.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(Blockly.selected!=this){var a=null;if(Blockly.selected){a=Blockly.selected.id;Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect()}};
|
|
1458
|
+
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect()}};
|
|
1459
|
+
Blockly.BlockSvg.prototype.initCatStuff=function(){if(Blockly.theme===Blockly.Themes.CAT_BLOCKS&&!this.hasInitCatStuff){this.hasInitCatStuff=!0;var a=this;this.svgPath_.ear=Blockly.utils.createSvgElement("path",{},this.svgPath_);this.svgPath_.ear2=Blockly.utils.createSvgElement("path",{},this.svgPath_);this.RTL&&(this.svgPath_.ear.setAttribute("transform","scale(-1 1)"),this.svgPath_.ear2.setAttribute("transform","scale(-1 1)"));this.svgPath_.addEventListener("mouseenter",function(b){clearTimeout(a.blinkFn);
|
|
1460
|
+
b.target.svgFace.eye&&(b.target.svgFace.eye.setAttribute("fill-opacity","0"),b.target.svgFace.eye2.setAttribute("fill-opacity","0"),b.target.svgFace.closedEye.setAttribute("fill-opacity","0.6"),b.target.svgFace.closedEye2.setAttribute("fill-opacity","0.6"));a.blinkFn=setTimeout(function(){b.target.svgFace.eye&&(b.target.svgFace.eye.setAttribute("fill-opacity","0.6"),b.target.svgFace.eye2.setAttribute("fill-opacity","0.6"),b.target.svgFace.closedEye.setAttribute("fill-opacity","0"),b.target.svgFace.closedEye2.setAttribute("fill-opacity",
|
|
1461
|
+
"0"))},100)});this.svgPath_.ear.addEventListener("mouseenter",function(){clearTimeout(a.earFn);clearTimeout(a.ear2Fn);a.svgPath_.ear.setAttribute("fill-opacity","0");a.svgPath_.ear2.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8","c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5");b=b.replace("h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0","c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8");
|
|
1462
|
+
b=b.replace("c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1","c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4");b=b.replace("c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0","c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1");a.svgPath_.svgBody.setAttribute("d",b);a.earFn=setTimeout(function(){a.svgPath_.ear.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5",
|
|
1463
|
+
"c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8");b=b.replace("c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8","h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0");a.svgPath_.svgBody.setAttribute("d",b)},50)});this.svgPath_.ear2.addEventListener("mouseenter",function(){clearTimeout(a.earFn);clearTimeout(a.ear2Fn);a.svgPath_.ear2.setAttribute("fill-opacity","0");a.svgPath_.ear.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");
|
|
1464
|
+
b=b.replace("c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4","c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1");b=b.replace("c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1","c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0");b=b.replace("c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5","c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8");b=b.replace("c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8",
|
|
1465
|
+
"h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0");a.svgPath_.svgBody.setAttribute("d",b);a.ear2Fn=setTimeout(function(){a.svgPath_.ear2.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1","c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4");b=b.replace("c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0","c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1");
|
|
1466
|
+
a.svgPath_.svgBody.setAttribute("d",b)},50)});this.windowListener=function(b){var c=Date.now();if(!(c<a.lastCallTime+a.CALL_FREQUENCY_MS)&&(a.lastCallTime=c,a.shouldWatchMouse()&&a.workspace)){var d=a.getCatFacePosition();c=b.x/a.workspace.scale-d.x;d=b.y/a.workspace.scale-d.y;b=Math.atan2(c,d);c=Math.sqrt(c*c+d*d);d=c/(c+1);var e=10/Math.sqrt(Math.pow(5*Math.cos(b),2)+Math.pow(2*Math.sin(b),2));c=e*d*Math.sin(b);d=e*d*Math.cos(b);a.RTL&&(c-=87);a.svgFace_.style.transform="translate("+c+"px, "+d+
|
|
1467
|
+
"px)"}};this.RTL&&(this.svgFace_.style.transform="translate(-87px, 0px)");this.shouldWatchMouse()&&document.addEventListener("mousemove",this.windowListener)}};
|
|
1468
|
+
Blockly.BlockSvg.prototype.getCatFacePosition=function(){var a=92;var b=120;!this.isInFlyout&&this.workspace.getFlyout()&&(b+=this.workspace.getFlyout().getWidth());b+=this.workspace.scrollX;a+=this.workspace.scrollY;var c=this.getRelativeToSurfaceXY(this.svgGroup_);this.RTL&&(c.x=this.workspace.getWidth()-c.x-this.width);c.x+=b/this.workspace.scale;c.y+=a/this.workspace.scale;c.x-=43.5;c.y-=4;this.RTL&&(c.x=screen.width-c.x);return c};
|
|
1469
|
+
Blockly.BlockSvg.prototype.shouldWatchMouse=function(){if(window.vmLoadHigh||!window.CAT_CHASE_MOUSE)return!1;var a=this.getCatFacePosition(),b=0<a.x&&a.x<screen.width/this.workspace.scale;a=0<a.y&&a.y<screen.height/this.workspace.scale;return this.startHat_&&!this.isGlowingStack_&&b&&a};Blockly.BlockSvg.prototype.setGlowBlock=function(a){this.isGlowingBlock_=a;this.updateColour()};
|
|
1470
|
+
Blockly.BlockSvg.prototype.setGlowStack=function(a){Blockly.theme===Blockly.Themes.CAT_BLOCKS&&(a?(document.removeEventListener("mousemove",this.windowListener),this.workspace&&this.svgFace_.style&&(this.svgFace_.style.transform=this.RTL?"translate(-87px, 0px)":"")):document.addEventListener("mousemove",this.windowListener));this.isGlowingStack_=a;a=this.getSvgRoot();this.isGlowingStack_&&!a.hasAttribute("filter")?a.setAttribute("filter","url(#"+(this.workspace.options.stackGlowFilterId||"blocklyStackGlowFilter")+
|
|
1471
|
+
")"):!this.isGlowingStack_&&a.hasAttribute("filter")&&a.removeAttribute("filter")};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null;Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};
|
|
1459
1472
|
Blockly.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!=b){Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),b=this.getRelativeToSurfaceXY(),this.moveConnections_(b.x-d.x,b.y-d.y),this.isShadow()&&this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary(),this.getColourQuaternary())):
|
|
1460
1473
|
b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y))}}};
|
|
1461
1474
|
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.blockDragSurface_.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.utils.getRelativeXY(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.blockDragSurface_.getCurrentBlock()==d&&(e=this.workspace.blockDragSurface_.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
|
|
@@ -1472,9 +1485,9 @@ this.customContextMenu(b);Blockly.ContextMenu.show(a,b,this.RTL);Blockly.Context
|
|
|
1472
1485
|
Blockly.BlockSvg.prototype.setDragging=function(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0));Blockly.utils.addClass(this.svgGroup_,"blocklyDragging")}else Blockly.draggingConnections_=[],Blockly.utils.removeClass(this.svgGroup_,"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)};
|
|
1473
1486
|
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.utils.addClass(this.svgGroup_,"blocklyDraggable"):Blockly.utils.removeClass(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);a=this.getIcons();for(var b=0;b<a.length;b++)a[b].updateEditable()};
|
|
1474
1487
|
Blockly.BlockSvg.prototype.setShadow=function(a){Blockly.BlockSvg.superClass_.setShadow.call(this,a);this.updateColour()};Blockly.BlockSvg.prototype.setInsertionMarker=function(a,b){Blockly.BlockSvg.superClass_.setInsertionMarker.call(this,a);this.insertionMarkerMinWidth_=b;this.updateColour()};Blockly.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
|
|
1475
|
-
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&
|
|
1476
|
-
a);goog.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};Blockly.BlockSvg.prototype.updateDisabled=function(){};
|
|
1477
|
-
Blockly.BlockSvg.prototype.setCommentText=function(a,b,c,d,e){var f=!1;goog.isString(a)?this.comment?this.comment.setText(a):(this.comment=new Blockly.ScratchBlockComment(this,a,b,c,d,e),f=!0):this.comment&&(this.comment.dispose(),f=!0);f&&this.rendered&&(this.render(),goog.isString(a)&&this.comment.setVisible(!0),this.bumpNeighbours_())};
|
|
1488
|
+
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){this.blinkFn&&clearTimeout(this.blinkFn);this.earFn&&clearTimeout(this.earFn);this.ear2Fn&&clearTimeout(this.ear2Fn);this.windowListener&&document.removeEventListener("mousemove",this.windowListener);Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&
|
|
1489
|
+
(this.unplug(a),Blockly.BlockAnimations.disposeUiEffect(this));this.rendered=!1;Blockly.Events.disable();try{var d=this.getIcons();for(b=0;b<d.length;b++)d[b].dispose()}finally{Blockly.Events.enable()}Blockly.BlockSvg.superClass_.dispose.call(this,a);goog.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgFace_=this.svgPathBody_=this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};Blockly.BlockSvg.prototype.updateDisabled=function(){};
|
|
1490
|
+
Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""};Blockly.BlockSvg.prototype.setCommentText=function(a,b,c,d,e){var f=!1;goog.isString(a)?this.comment?this.comment.setText(a):(this.comment=new Blockly.ScratchBlockComment(this,a,b,c,d,e),f=!0):this.comment&&(this.comment.dispose(),f=!0);f&&this.rendered&&(this.render(),goog.isString(a)&&this.comment.setVisible(!0),this.bumpNeighbours_())};
|
|
1478
1491
|
Blockly.BlockSvg.prototype.setWarningText=function(a,b){this.setWarningText.pid_||(this.setWarningText.pid_=Object.create(null));var c=b||"";if(c)this.setWarningText.pid_[c]&&(clearTimeout(this.setWarningText.pid_[c]),delete this.setWarningText.pid_[c]);else for(var d in this.setWarningText.pid_)clearTimeout(this.setWarningText.pid_[d]),delete this.setWarningText.pid_[d];if(this.workspace.isDragging()){var e=this;this.setWarningText.pid_[c]=setTimeout(function(){e.workspace&&(delete e.setWarningText.pid_[c],
|
|
1479
1492
|
e.setWarningText(a,c))},100)}else this.isInFlyout&&(a=null),b=!1,goog.isString(a)?(this.warning||(this.warning=new Blockly.Warning(this),b=!0),this.warning.setText(a,c)):this.warning&&!c?(this.warning.dispose(),b=!0):this.warning&&(b=this.warning.getText(),this.warning.setText("",c),(d=this.warning.getText())||this.warning.dispose(),b=b!=d),b&&this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
1480
1493
|
Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,a.createIcon())};Blockly.BlockSvg.prototype.addSelect=function(){Blockly.utils.addClass(this.svgGroup_,"blocklySelected")};Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.utils.removeClass(this.svgGroup_,"blocklySelected")};
|
|
@@ -1492,8 +1505,8 @@ Blockly.BlockSvg.NOTCH_PATH_UP="c 0,-2 1,-3 2,-4 l 4,-4 c 1,-1 2,-2 2,-4 v -12 c
|
|
|
1492
1505
|
Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START="m "+Blockly.BlockSvg.HAT_CORNER_RADIUS+",0";Blockly.BlockSvg.HAT_TOP_LEFT_CORNER="A "+Blockly.BlockSvg.HAT_CORNER_RADIUS+","+Blockly.BlockSvg.HAT_CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.HAT_CORNER_RADIUS;Blockly.BlockSvg.renderingMetrics_=null;Blockly.BlockSvg.MAX_DISPLAY_LENGTH=4;
|
|
1493
1506
|
Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_INITIAL=12;Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_FINAL=14;Blockly.BlockSvg.FIELD_TEXTINPUT_EXPAND_PAST_TRUNCATION=!0;Blockly.BlockSvg.FIELD_TEXTINPUT_ANIMATE_POSITIONING=!0;Blockly.BlockSvg.metricsAreEquivalent_=function(a,b){return a.statement!=b.statement||a.imageField!=b.imageField||a.height!=b.height||a.width!=b.width||a.bayHeight!=b.bayHeight||a.bayWidth!=b.bayWidth||a.fieldRadius!=b.fieldRadius||a.startHat!=b.startHat?!1:!0};
|
|
1494
1507
|
Blockly.BlockSvg.prototype.connectionUiEffect=function(){this.workspace.getAudioManager().play("click")};
|
|
1495
|
-
Blockly.BlockSvg.prototype.updateColour=function(){this.isGlowing_?this.getColourSecondary():this.getColour();var a=this.getColourTertiary();this.
|
|
1496
|
-
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?(this.
|
|
1508
|
+
Blockly.BlockSvg.prototype.updateColour=function(){this.isGlowing_?this.getColourSecondary():this.getColour();var a=this.getColourTertiary();this.blockFrameElement_.setAttribute("stroke",a);a=this.isGlowingBlock_?this.getColourSecondary():this.getColour();this.blockFrameElement_.setAttribute("fill",a);this.blockFrameElement_.setAttribute("fill-opacity",this.getOpacity());a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.setText(null)};
|
|
1509
|
+
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?(this.blockFrameElement_.setAttribute("filter","url(#"+(this.workspace.options.replacementGlowFilterId||"blocklyReplacementGlowFilter")+")"),Blockly.utils.addClass(this.svgGroup_,"blocklyReplaceable")):(this.blockFrameElement_.removeAttribute("filter"),Blockly.utils.removeClass(this.svgGroup_,"blocklyReplaceable"))};
|
|
1497
1510
|
Blockly.BlockSvg.prototype.getHeightWidth=function(a){var b=this.height,c=this.width;!a&&this.getFieldShadowBlock_()&&(b+=Blockly.BlockSvg.FIELD_Y_OFFSET,b+=Blockly.BlockSvg.FIELD_HEIGHT);var d=this.getNextBlock();d&&(a=d.getHeightWidth(a),c+=a.width,c-=Blockly.BlockSvg.NOTCH_WIDTH,b=Math.max(b,a.height));return{height:b,width:c}};
|
|
1498
1511
|
Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=this.renderingMetrics_,c=this.renderCompute_();b&&Blockly.BlockSvg.metricsAreEquivalent_(b,c)?(c.statement&&c.statement.connection&&c.statement.targetConnection&&c.statement.connection.tighten_(),this.nextConnection&&this.nextConnection.targetConnection&&this.nextConnection.tighten_()):(this.height=c.height,this.width=c.width,this.renderDraw_(c),this.renderClassify_(c),this.renderingMetrics_=c);!1!==a&&
|
|
1499
1512
|
((a=this.getParent())?a.render(!0):Blockly.resizeSvgContents(this.workspace));Blockly.Field.stopCache()};
|
|
@@ -1501,9 +1514,9 @@ Blockly.BlockSvg.prototype.renderCompute_=function(){for(var a={statement:null,i
|
|
|
1501
1514
|
d.height);a.bayWidth=Math.max(a.bayWidth,d.width)}(d=c.connection.targetBlock())&&!d.lastConnectionInStack()?a.bayNotchAtRight=!1:a.bayWidth-=Blockly.BlockSvg.NOTCH_WIDTH}d=0;for(var e;e=c.fieldRow[d];d++)e instanceof Blockly.FieldImage&&(a.imageField=e),e instanceof Blockly.FieldIconMenu&&(a.iconMenu=e),a.fieldRadius=e instanceof Blockly.FieldTextInput?e.getBorderRadius():Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS}this.nextConnection&&!this.previousConnection&&(a.startHat=!0);this.nextConnection||
|
|
1502
1515
|
!this.previousConnection||this.outputConnection||a.statement||(a.endCap=!0);a.iconMenu&&(b=a.iconMenu.getSrcForValue(a.iconMenu.getValue()))&&a.iconMenu.setParentFieldImage(b);a.width=2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.IMAGE_FIELD_WIDTH;a.height=2*Blockly.BlockSvg.SEP_SPACE_Y+Blockly.BlockSvg.IMAGE_FIELD_HEIGHT;this.outputConnection&&(a.height=Blockly.BlockSvg.FIELD_HEIGHT,a.width=Blockly.BlockSvg.FIELD_WIDTH);a.statement&&(a.width+=a.bayWidth+4*Blockly.BlockSvg.CORNER_RADIUS+2*Blockly.BlockSvg.GRID_UNIT,
|
|
1503
1516
|
a.height=a.bayHeight+Blockly.BlockSvg.STATEMENT_BLOCK_SPACE);a.startHat&&(a.width+=1*Blockly.BlockSvg.GRID_UNIT);a.endCap&&(a.width+=1*Blockly.BlockSvg.GRID_UNIT);return a};
|
|
1504
|
-
Blockly.BlockSvg.prototype.renderDraw_=function(a){var b=this.getRelativeToSurfaceXY(),c=[];this.renderDrawLeft_(c,b,a);this.renderDrawBottom_(c,b,a);this.renderDrawRight_(c,b,a);this.renderDrawTop_(c,b,a);b=c.join(" ");this.
|
|
1505
|
-
(d-=Blockly.BlockSvg.GRID_UNIT);var f="scale(1 1)";this.RTL&&(a.imageField.getFlipRTL()?(f="scale(-1 1)",d=-a.width+c.width+Blockly.BlockSvg.SEP_SPACE_X/1.5):d=-a.width+Blockly.BlockSvg.SEP_SPACE_X/1.5);b&&(this.isInsertionMarker()&&b.setAttribute("display","none"),b.setAttribute("transform","translate("+d+","+e+") "+f))}this.getFieldShadowBlock_()&&(b=this.getFieldShadowBlock_().getSvgRoot(),c=Blockly.BlockSvg.NOTCH_WIDTH+(a.bayWidth?2*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.NOTCH_WIDTH:
|
|
1506
|
-
a.bayWidth,a.startHat&&(c+=2*Blockly.BlockSvg.GRID_UNIT),this.RTL&&(c=-c),b.setAttribute("transform","translate("+c+","+(a.height+Blockly.BlockSvg.FIELD_Y_OFFSET)+")"))};
|
|
1517
|
+
Blockly.BlockSvg.prototype.renderDraw_=function(a){var b=this.getRelativeToSurfaceXY(),c=[];this.renderDrawLeft_(c,b,a);this.renderDrawBottom_(c,b,a);this.renderDrawRight_(c,b,a);this.renderDrawTop_(c,b,a);b=c.join(" ");this.blockFrameElement_.setAttribute("d",b);this.RTL&&this.blockFrameElement_.setAttribute("transform","scale(-1 1)");if(a.imageField){b=a.imageField.getSvgRoot();c=a.imageField.getSize();var d=a.width-c.width-Blockly.BlockSvg.SEP_SPACE_X/1.5,e=a.height-c.height-Blockly.BlockSvg.SEP_SPACE_Y;
|
|
1518
|
+
a.endCap&&(d-=Blockly.BlockSvg.GRID_UNIT);var f="scale(1 1)";this.RTL&&(a.imageField.getFlipRTL()?(f="scale(-1 1)",d=-a.width+c.width+Blockly.BlockSvg.SEP_SPACE_X/1.5):d=-a.width+Blockly.BlockSvg.SEP_SPACE_X/1.5);b&&(this.isInsertionMarker()&&b.setAttribute("display","none"),b.setAttribute("transform","translate("+d+","+e+") "+f))}this.getFieldShadowBlock_()&&(b=this.getFieldShadowBlock_().getSvgRoot(),c=Blockly.BlockSvg.NOTCH_WIDTH+(a.bayWidth?2*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.NOTCH_WIDTH:
|
|
1519
|
+
0)+a.bayWidth,a.startHat&&(c+=2*Blockly.BlockSvg.GRID_UNIT),this.RTL&&(c=-c),b.setAttribute("transform","translate("+c+","+(a.height+Blockly.BlockSvg.FIELD_Y_OFFSET)+")"))};
|
|
1507
1520
|
Blockly.BlockSvg.prototype.renderClassify_=function(a){var b=[];this.isShadow_?b.push("argument"):(a.statement&&b.push("c-block"),a.startHat?b.push("hat"):a.statement||b.push("stack"),this.nextConnection||b.push("end"));this.svgGroup_.setAttribute("data-shapes",b.join(" "));this.getCategory()&&this.svgGroup_.setAttribute("data-category",this.getCategory())};
|
|
1508
1521
|
Blockly.BlockSvg.prototype.renderDrawLeft_=function(a,b,c){c.startHat?(a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER)):this.previousConnection?(a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),a.push("V",c.height-Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.SEP_SPACE_Y-Blockly.BlockSvg.NOTCH_HEIGHT),a.push(Blockly.BlockSvg.NOTCH_PATH_DOWN),this.previousConnection.moveTo(b.x,b.y+c.height-2*Blockly.BlockSvg.CORNER_RADIUS),
|
|
1509
1522
|
a.push("V",c.height-Blockly.BlockSvg.CORNER_RADIUS)):(a.push("m",c.fieldRadius+",0"),a.push("A",c.fieldRadius+","+c.fieldRadius,"0","0,0","0,"+c.fieldRadius),a.push("V",c.height-c.fieldRadius))};
|
|
@@ -2241,8 +2254,8 @@ Blockly.init_=function(a){var b=a.options,c=a.getParentSvg();Blockly.bindEventWi
|
|
|
2241
2254
|
b.horizontalLayout?(a.scrollY=a.flyout_.height_,b.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM&&(a.scrollY*=-1)):(a.scrollX=a.flyout_.width_,b.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(a.scrollX*=-1)),a.translate(a.scrollX,a.scrollY)));b.hasScrollbars&&(a.scrollbar=new Blockly.ScrollbarPair(a),a.scrollbar.resize());b.hasSounds&&Blockly.inject.loadSounds_(b.pathToMedia,a)};
|
|
2242
2255
|
Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown_),Blockly.bindEvent_(document,"touchend",null,Blockly.longStop_),Blockly.bindEvent_(document,"touchcancel",null,Blockly.longStop_),goog.userAgent.IPAD&&Blockly.bindEventWithChecks_(window,"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())}));Blockly.documentEventsBound_=!0};
|
|
2243
2256
|
Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,a,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,a,!0))};
|
|
2244
|
-
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.cache3dSupported_=null;Blockly.hueToRgb=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
2245
|
-
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};
|
|
2257
|
+
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.cache3dSupported_=null;Blockly.theme_=Blockly.Themes.CLASSIC;Blockly.hueToRgb=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
2258
|
+
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};Object.defineProperty(Blockly,"theme",{get:function(){return Blockly.theme_}});Blockly.setTheme=function(a){Blockly.theme_=a===Blockly.Themes.CAT_BLOCKS?a:Blockly.Themes.CLASSIC};
|
|
2246
2259
|
Blockly.onKeyDown_=function(a){if(!(Blockly.mainWorkspace.options.readOnly||Blockly.utils.isTargetInput(a)||Blockly.mainWorkspace.rendered&&!Blockly.mainWorkspace.isVisible())){var b=!1;if(27==a.keyCode)Blockly.hideChaff(),Blockly.DropDownDiv.hide();else if(8==a.keyCode||46==a.keyCode){a.preventDefault();if(Blockly.mainWorkspace.isDragging())return;Blockly.selected&&Blockly.selected.isDeletable()&&(b=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.mainWorkspace.isDragging())return;Blockly.selected&&
|
|
2247
2260
|
Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(67==a.keyCode?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):88!=a.keyCode||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),b=!0));86==a.keyCode?Blockly.clipboardXml_&&(Blockly.Events.setGroup(!0),a=Blockly.clipboardSource_,a.isFlyout&&(a=a.targetWorkspace),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1)):90==a.keyCode&&(Blockly.hideChaff(),Blockly.mainWorkspace.undo(a.shiftKey))}b&&!Blockly.selected.workspace.isFlyout&&
|
|
2248
2261
|
(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}};Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace};
|
|
@@ -657,7 +657,7 @@ d;return{connection:c,radius:g}};Blockly.ConnectionDB.init=function(a){var b=[];
|
|
|
657
657
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
658
658
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.Categories={motion:"motion",looks:"looks",sound:"sounds",pen:"pen",data:"data",dataLists:"data-lists",event:"events",control:"control",sensing:"sensing",operators:"operators",more:"more"};Blockly.DELETE_AREA_NONE=null;
|
|
659
659
|
Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.NEW_BROADCAST_MESSAGE_ID="NEW_BROADCAST_MESSAGE_ID";Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE="broadcast_msg";Blockly.LIST_VARIABLE_TYPE="list";Blockly.SCALAR_VARIABLE_TYPE="";Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE="procedures_definition";
|
|
660
|
-
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Variables={};Blockly.Variables.NAME_TYPE=Blockly.VARIABLE_CATEGORY_NAME;Blockly.Variables.CLOUD_PREFIX="\u2601 ";
|
|
660
|
+
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Themes={CLASSIC:"classic",CAT_BLOCKS:"catblocks"};Blockly.Variables={};Blockly.Variables.NAME_TYPE=Blockly.VARIABLE_CATEGORY_NAME;Blockly.Variables.CLOUD_PREFIX="\u2601 ";
|
|
661
661
|
Blockly.Variables.allUsedVariables=function(a){if(a instanceof Blockly.Block)var b=a.getDescendants(!1);else if(a instanceof Blockly.Workspace||a instanceof Blockly.WorkspaceSvg)b=a.getAllBlocks();else throw"Not Block or Workspace: "+a;var c=Blockly.Variables.noVariableText();a=Object.create(null);for(var d=0;d<b.length;d++){var e=b[d].getVarModels();if(e)for(var f=0;f<e.length;f++){var g=e[f];g.getId()&&g.name.toLowerCase()!=c&&(a[g.name.toLowerCase()]=g.name)}}b=[];for(var h in a)b.push(a[h]);return b};
|
|
662
662
|
Blockly.Variables.allVariables=function(a){return a instanceof Blockly.Block?(console.warn("Deprecated call to Blockly.Variables.allVariables with a block instead of a workspace. You may want Blockly.Variables.allUsedVariables"),{}):a.getAllVariables()};Blockly.Variables.allDeveloperVariables=function(a){var b=a.getAllBlocks();a={};for(var c=0;c<b.length;c++){var d=b[c];if(d.getDeveloperVars){d=d.getDeveloperVars();for(var e=0;e<d.length;e++)a[d[e]]=d[e]}}b=[];for(var f in a)b.push(a[f]);return b};
|
|
663
663
|
Blockly.Variables.noVariableText=function(){return"No variable selected"};Blockly.Variables.generateUniqueName=function(a){a=a.getAllVariables();var b="";if(a.length)for(var c=1,d=0,e="ijkmnopqrstuvwxyzabcdefgh".charAt(d);!b;){for(var f=!1,g=0;g<a.length;g++)if(a[g].name.toLowerCase()==e){f=!0;break}f?(d++,25==d&&(d=0,c++),e="ijkmnopqrstuvwxyzabcdefgh".charAt(d),1<c&&(e+=c)):b=e}else b="i";return b};
|
|
@@ -1449,13 +1449,26 @@ goog.Promise.setUnhandledRejectionHandler=function(a){goog.Promise.handleRejecti
|
|
|
1449
1449
|
goog.Timer.prototype.setInterval=function(a){this.interval_=a;this.timer_&&this.enabled?(this.stop(),this.start()):this.timer_&&this.stop()};goog.Timer.prototype.tick_=function(){if(this.enabled){var a=goog.now()-this.last_;0<a&&a<this.interval_*goog.Timer.intervalScale?this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_-a):(this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null),this.dispatchTick(),this.enabled&&(this.stop(),this.start()))}};
|
|
1450
1450
|
goog.Timer.prototype.dispatchTick=function(){this.dispatchEvent(goog.Timer.TICK)};goog.Timer.prototype.start=function(){this.enabled=!0;this.timer_||(this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now())};goog.Timer.prototype.stop=function(){this.enabled=!1;this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null)};goog.Timer.prototype.disposeInternal=function(){goog.Timer.superClass_.disposeInternal.call(this);this.stop();delete this.timerObject_};
|
|
1451
1451
|
goog.Timer.TICK="tick";goog.Timer.callOnce=function(a,b,c){if(goog.isFunction(a))c&&(a=goog.bind(a,c));else if(a&&"function"==typeof a.handleEvent)a=goog.bind(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(b)>goog.Timer.MAX_TIMEOUT_?goog.Timer.INVALID_TIMEOUT_ID_:goog.Timer.defaultTimerObject.setTimeout(a,b||0)};goog.Timer.clear=function(a){goog.Timer.defaultTimerObject.clearTimeout(a)};
|
|
1452
|
-
goog.Timer.promise=function(a,b){var c=null;return(new goog.Promise(function(d,e){c=goog.Timer.callOnce(function(){d(b)},a);c==goog.Timer.INVALID_TIMEOUT_ID_&&e(Error("Failed to schedule timer."))})).thenCatch(function(a){goog.Timer.clear(c);throw a;})};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.createSvgElement("g",{},null);this.svgPath_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.
|
|
1452
|
+
goog.Timer.promise=function(a,b){var c=null;return(new goog.Promise(function(d,e){c=goog.Timer.callOnce(function(){d(b)},a);c==goog.Timer.INVALID_TIMEOUT_ID_&&e(Error("Failed to schedule timer."))})).thenCatch(function(a){goog.Timer.clear(c);throw a;})};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.createSvgElement("g",{},null);Blockly.theme===Blockly.Themes.CAT_BLOCKS?(this.svgPath_=Blockly.utils.createSvgElement("g",{},this.svgGroup_),this.svgPathBody_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.svgPath_),this.svgFace_=Blockly.utils.createSvgElement("g",{},this.svgPath_),this.svgGroup_.svgPath=this.svgPath_,this.svgPath_.svgFace=this.svgFace_,this.svgPath_.svgBody=this.svgPathBody_,
|
|
1453
|
+
this.lastCallTime=0,this.CALL_FREQUENCY_MS=60,this.svgPathBody_.tooltip=this):(this.svgPath_=Blockly.utils.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.svgGroup_),this.svgPath_.tooltip=this);this.rendered=!1;this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.Tooltip.bindMouseEvents(this.blockFrameElement_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c);this.svgGroup_.dataset&&(this.svgGroup_.dataset.id=this.id)};
|
|
1453
1454
|
goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.insertionMarkerMinWidth_=0;Blockly.BlockSvg.prototype.opacity_=1;Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.isGlowingBlock_=!1;Blockly.BlockSvg.prototype.isGlowingStack_=!1;Blockly.BlockSvg.INLINE=-1;
|
|
1454
|
-
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(
|
|
1455
|
-
this.
|
|
1456
|
-
Blockly.BlockSvg.prototype.
|
|
1457
|
-
Blockly.BlockSvg.prototype.
|
|
1458
|
-
Blockly.BlockSvg.prototype.
|
|
1455
|
+
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(this.isInsertionMarker())this.svgPathBody_&&this.svgPathBody_.setAttribute("stroke-opacity","0");else{for(var a=0,b;b=this.inputList[a];a++)b.init(),b.initOutlinePath(this.svgGroup_);b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon()}this.updateColour();this.updateMovable();this.workspace.options.readOnly||this.eventsInit_||Blockly.bindEventWithChecks_(this.getSvgRoot(),"mousedown",
|
|
1456
|
+
this,this.onMouseDown_);this.eventsInit_=!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};Object.defineProperty(Blockly.BlockSvg.prototype,"blockFrameElement_",{get:function(){return Blockly.theme===Blockly.Themes.CAT_BLOCKS?this.svgPathBody_:this.svgPath_},enumerable:!0,configurable:!0});
|
|
1457
|
+
Blockly.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(Blockly.selected!=this){var a=null;if(Blockly.selected){a=Blockly.selected.id;Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect()}};
|
|
1458
|
+
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect()}};
|
|
1459
|
+
Blockly.BlockSvg.prototype.initCatStuff=function(){if(Blockly.theme===Blockly.Themes.CAT_BLOCKS&&!this.hasInitCatStuff){this.hasInitCatStuff=!0;var a=this;this.svgPath_.ear=Blockly.utils.createSvgElement("path",{},this.svgPath_);this.svgPath_.ear2=Blockly.utils.createSvgElement("path",{},this.svgPath_);this.RTL&&(this.svgPath_.ear.setAttribute("transform","scale(-1 1)"),this.svgPath_.ear2.setAttribute("transform","scale(-1 1)"));this.svgPath_.addEventListener("mouseenter",function(b){clearTimeout(a.blinkFn);
|
|
1460
|
+
b.target.svgFace.eye&&(b.target.svgFace.eye.setAttribute("fill-opacity","0"),b.target.svgFace.eye2.setAttribute("fill-opacity","0"),b.target.svgFace.closedEye.setAttribute("fill-opacity","0.6"),b.target.svgFace.closedEye2.setAttribute("fill-opacity","0.6"));a.blinkFn=setTimeout(function(){b.target.svgFace.eye&&(b.target.svgFace.eye.setAttribute("fill-opacity","0.6"),b.target.svgFace.eye2.setAttribute("fill-opacity","0.6"),b.target.svgFace.closedEye.setAttribute("fill-opacity","0"),b.target.svgFace.closedEye2.setAttribute("fill-opacity",
|
|
1461
|
+
"0"))},100)});this.svgPath_.ear.addEventListener("mouseenter",function(){clearTimeout(a.earFn);clearTimeout(a.ear2Fn);a.svgPath_.ear.setAttribute("fill-opacity","0");a.svgPath_.ear2.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8","c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5");b=b.replace("h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0","c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8");
|
|
1462
|
+
b=b.replace("c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1","c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4");b=b.replace("c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0","c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1");a.svgPath_.svgBody.setAttribute("d",b);a.earFn=setTimeout(function(){a.svgPath_.ear.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5",
|
|
1463
|
+
"c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8");b=b.replace("c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8","h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0");a.svgPath_.svgBody.setAttribute("d",b)},50)});this.svgPath_.ear2.addEventListener("mouseenter",function(){clearTimeout(a.earFn);clearTimeout(a.ear2Fn);a.svgPath_.ear2.setAttribute("fill-opacity","0");a.svgPath_.ear.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");
|
|
1464
|
+
b=b.replace("c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4","c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1");b=b.replace("c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1","c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0");b=b.replace("c7.2,1 28,-11.9 31.7,-10.1c3.1,1.5 0.9,14.7 -4.9,19.5","c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8");b=b.replace("c0,0 25.6,0 44,0c7.4,-3.2 14.8,-6.8 16.9,-5.8c1.2,0.6 1.6,2.9 1.3,5.8",
|
|
1465
|
+
"h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0");a.svgPath_.svgBody.setAttribute("d",b);a.ear2Fn=setTimeout(function(){a.svgPath_.ear2.setAttribute("fill-opacity","");var b=a.svgPath_.svgBody.getAttribute("d");b=b.replace("c-5.8,-4.8 -8,-18 -4.9,-19.5c3.7,-1.8 24.5,11.1 31.7,10.1","c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4");b=b.replace("c0,-4.6 1.6,-8.9 4.3,-12.3c-2.4,-5.6 -2.9,-12.4 -0.7,-13.4c2.1,-1 9.6,2.6 17,5.8c2.6,0 6.2,0 10.9,0","c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1");
|
|
1466
|
+
a.svgPath_.svgBody.setAttribute("d",b)},50)});this.windowListener=function(b){var c=Date.now();if(!(c<a.lastCallTime+a.CALL_FREQUENCY_MS)&&(a.lastCallTime=c,a.shouldWatchMouse()&&a.workspace)){var d=a.getCatFacePosition();c=b.x/a.workspace.scale-d.x;d=b.y/a.workspace.scale-d.y;b=Math.atan2(c,d);c=Math.sqrt(c*c+d*d);d=c/(c+1);var e=10/Math.sqrt(Math.pow(5*Math.cos(b),2)+Math.pow(2*Math.sin(b),2));c=e*d*Math.sin(b);d=e*d*Math.cos(b);a.RTL&&(c-=87);a.svgFace_.style.transform="translate("+c+"px, "+d+
|
|
1467
|
+
"px)"}};this.RTL&&(this.svgFace_.style.transform="translate(-87px, 0px)");this.shouldWatchMouse()&&document.addEventListener("mousemove",this.windowListener)}};
|
|
1468
|
+
Blockly.BlockSvg.prototype.getCatFacePosition=function(){var a=92;var b=120;!this.isInFlyout&&this.workspace.getFlyout()&&(b+=this.workspace.getFlyout().getWidth());b+=this.workspace.scrollX;a+=this.workspace.scrollY;var c=this.getRelativeToSurfaceXY(this.svgGroup_);this.RTL&&(c.x=this.workspace.getWidth()-c.x-this.width);c.x+=b/this.workspace.scale;c.y+=a/this.workspace.scale;c.x-=43.5;c.y-=4;this.RTL&&(c.x=screen.width-c.x);return c};
|
|
1469
|
+
Blockly.BlockSvg.prototype.shouldWatchMouse=function(){if(window.vmLoadHigh||!window.CAT_CHASE_MOUSE)return!1;var a=this.getCatFacePosition(),b=0<a.x&&a.x<screen.width/this.workspace.scale;a=0<a.y&&a.y<screen.height/this.workspace.scale;return this.startHat_&&!this.isGlowingStack_&&b&&a};Blockly.BlockSvg.prototype.setGlowBlock=function(a){this.isGlowingBlock_=a;this.updateColour()};
|
|
1470
|
+
Blockly.BlockSvg.prototype.setGlowStack=function(a){Blockly.theme===Blockly.Themes.CAT_BLOCKS&&(a?(document.removeEventListener("mousemove",this.windowListener),this.workspace&&this.svgFace_.style&&(this.svgFace_.style.transform=this.RTL?"translate(-87px, 0px)":"")):document.addEventListener("mousemove",this.windowListener));this.isGlowingStack_=a;a=this.getSvgRoot();this.isGlowingStack_&&!a.hasAttribute("filter")?a.setAttribute("filter","url(#"+(this.workspace.options.stackGlowFilterId||"blocklyStackGlowFilter")+
|
|
1471
|
+
")"):!this.isGlowingStack_&&a.hasAttribute("filter")&&a.removeAttribute("filter")};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null;Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};
|
|
1459
1472
|
Blockly.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!=b){Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),b=this.getRelativeToSurfaceXY(),this.moveConnections_(b.x-d.x,b.y-d.y),this.isShadow()&&this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary(),this.getColourQuaternary())):
|
|
1460
1473
|
b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y))}}};
|
|
1461
1474
|
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.blockDragSurface_.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.utils.getRelativeXY(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.blockDragSurface_.getCurrentBlock()==d&&(e=this.workspace.blockDragSurface_.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
|
|
@@ -1472,9 +1485,9 @@ this.customContextMenu(b);Blockly.ContextMenu.show(a,b,this.RTL);Blockly.Context
|
|
|
1472
1485
|
Blockly.BlockSvg.prototype.setDragging=function(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0));Blockly.utils.addClass(this.svgGroup_,"blocklyDragging")}else Blockly.draggingConnections_=[],Blockly.utils.removeClass(this.svgGroup_,"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)};
|
|
1473
1486
|
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.utils.addClass(this.svgGroup_,"blocklyDraggable"):Blockly.utils.removeClass(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);a=this.getIcons();for(var b=0;b<a.length;b++)a[b].updateEditable()};
|
|
1474
1487
|
Blockly.BlockSvg.prototype.setShadow=function(a){Blockly.BlockSvg.superClass_.setShadow.call(this,a);this.updateColour()};Blockly.BlockSvg.prototype.setInsertionMarker=function(a,b){Blockly.BlockSvg.superClass_.setInsertionMarker.call(this,a);this.insertionMarkerMinWidth_=b;this.updateColour()};Blockly.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
|
|
1475
|
-
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&
|
|
1476
|
-
a);goog.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};Blockly.BlockSvg.prototype.updateDisabled=function(){};
|
|
1477
|
-
Blockly.BlockSvg.prototype.setCommentText=function(a,b,c,d,e){var f=!1;goog.isString(a)?this.comment?this.comment.setText(a):(this.comment=new Blockly.ScratchBlockComment(this,a,b,c,d,e),f=!0):this.comment&&(this.comment.dispose(),f=!0);f&&this.rendered&&(this.render(),goog.isString(a)&&this.comment.setVisible(!0),this.bumpNeighbours_())};
|
|
1488
|
+
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){this.blinkFn&&clearTimeout(this.blinkFn);this.earFn&&clearTimeout(this.earFn);this.ear2Fn&&clearTimeout(this.ear2Fn);this.windowListener&&document.removeEventListener("mousemove",this.windowListener);Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&
|
|
1489
|
+
(this.unplug(a),Blockly.BlockAnimations.disposeUiEffect(this));this.rendered=!1;Blockly.Events.disable();try{var d=this.getIcons();for(b=0;b<d.length;b++)d[b].dispose()}finally{Blockly.Events.enable()}Blockly.BlockSvg.superClass_.dispose.call(this,a);goog.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgFace_=this.svgPathBody_=this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};Blockly.BlockSvg.prototype.updateDisabled=function(){};
|
|
1490
|
+
Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""};Blockly.BlockSvg.prototype.setCommentText=function(a,b,c,d,e){var f=!1;goog.isString(a)?this.comment?this.comment.setText(a):(this.comment=new Blockly.ScratchBlockComment(this,a,b,c,d,e),f=!0):this.comment&&(this.comment.dispose(),f=!0);f&&this.rendered&&(this.render(),goog.isString(a)&&this.comment.setVisible(!0),this.bumpNeighbours_())};
|
|
1478
1491
|
Blockly.BlockSvg.prototype.setWarningText=function(a,b){this.setWarningText.pid_||(this.setWarningText.pid_=Object.create(null));var c=b||"";if(c)this.setWarningText.pid_[c]&&(clearTimeout(this.setWarningText.pid_[c]),delete this.setWarningText.pid_[c]);else for(var d in this.setWarningText.pid_)clearTimeout(this.setWarningText.pid_[d]),delete this.setWarningText.pid_[d];if(this.workspace.isDragging()){var e=this;this.setWarningText.pid_[c]=setTimeout(function(){e.workspace&&(delete e.setWarningText.pid_[c],
|
|
1479
1492
|
e.setWarningText(a,c))},100)}else this.isInFlyout&&(a=null),b=!1,goog.isString(a)?(this.warning||(this.warning=new Blockly.Warning(this),b=!0),this.warning.setText(a,c)):this.warning&&!c?(this.warning.dispose(),b=!0):this.warning&&(b=this.warning.getText(),this.warning.setText("",c),(d=this.warning.getText())||this.warning.dispose(),b=b!=d),b&&this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
1480
1493
|
Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,a.createIcon())};Blockly.BlockSvg.prototype.addSelect=function(){Blockly.utils.addClass(this.svgGroup_,"blocklySelected")};Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.utils.removeClass(this.svgGroup_,"blocklySelected")};
|
|
@@ -1487,10 +1500,12 @@ Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.Render
|
|
|
1487
1500
|
Blockly.BlockSvg.prototype.bumpNeighbours_=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){d.isConnected()&&d.isSuperior()&&d.targetBlock().bumpNeighbours_();for(var e=d.neighbours_(Blockly.SNAP_RADIUS),f=0,g;g=e[f];f++)d.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!=a&&(d.isSuperior()?g.bumpAwayFrom_(d):d.bumpAwayFrom_(g))}}};
|
|
1488
1501
|
Blockly.BlockSvg.prototype.scheduleSnapAndBump=function(){var a=this,b=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(b);a.snapToGrid();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY/2);setTimeout(function(){Blockly.Events.setGroup(b);a.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)};Blockly.BlockSvg.render={};Blockly.BlockSvg.GRID_UNIT=4;Blockly.BlockSvg.SEP_SPACE_X=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.SEP_SPACE_Y=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X=16*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y=8*Blockly.BlockSvg.GRID_UNIT;
|
|
1489
1502
|
Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT=40*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y_SINGLE_FIELD_OUTPUT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT=6*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NOTCH_WIDTH=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NOTCH_HEIGHT=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;
|
|
1490
|
-
Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg
|
|
1491
|
-
Blockly.BlockSvg.
|
|
1492
|
-
Blockly.BlockSvg.
|
|
1493
|
-
Blockly.BlockSvg.
|
|
1503
|
+
Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE=2*Blockly.BlockSvg.GRID_UNIT;Object.defineProperty(Blockly.BlockSvg,"START_HAT_HEIGHT",{get:function(){return Blockly.theme===Blockly.Themes.CAT_BLOCKS?31:16},enumerable:!0,configurable:!0});Blockly.BlockSvg.ICON_SEPARATOR_HEIGHT=10*Blockly.BlockSvg.GRID_UNIT;
|
|
1504
|
+
Object.defineProperty(Blockly.BlockSvg,"START_HAT_PATH",{get:function(){return Blockly.theme===Blockly.Themes.CAT_BLOCKS?"c2.6,-2.3 5.5,-4.3 8.5,-6.2c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4c8.4,-1.3 17,-1.3 25.4,0c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8c3,1.8 5.9,3.9 8.5,6.1":"c 25,-22 71,-22 96,0"},enumerable:!0,configurable:!0});Blockly.BlockSvg.NOTCH_PATH_LEFT="c 2,0 3,1 4,2 l 4,4 c 1,1 2,2 4,2 h 12 c 2,0 3,-1 4,-2 l 4,-4 c 1,-1 2,-2 4,-2";
|
|
1505
|
+
Blockly.BlockSvg.NOTCH_PATH_RIGHT="c -2,0 -3,1 -4,2 l -4,4 c -1,1 -2,2 -4,2 h -12 c -2,0 -3,-1 -4,-2 l -4,-4 c -1,-1 -2,-2 -4,-2";Blockly.BlockSvg.NOTCH_START_PADDING=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0";
|
|
1506
|
+
Blockly.BlockSvg.TOP_RIGHT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.BOTTOM_RIGHT_CORNER=" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
1507
|
+
Blockly.BlockSvg.BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
1508
|
+
Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
1494
1509
|
Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL="M "+4*Blockly.BlockSvg.GRID_UNIT+",0 h "+4*Blockly.BlockSvg.GRID_UNIT+" l "+4*Blockly.BlockSvg.GRID_UNIT+","+4*Blockly.BlockSvg.GRID_UNIT+" l "+-4*Blockly.BlockSvg.GRID_UNIT+","+4*Blockly.BlockSvg.GRID_UNIT+" h "+-4*Blockly.BlockSvg.GRID_UNIT+" l "+-4*Blockly.BlockSvg.GRID_UNIT+","+-4*Blockly.BlockSvg.GRID_UNIT+" l "+4*Blockly.BlockSvg.GRID_UNIT+","+-4*Blockly.BlockSvg.GRID_UNIT+" z";Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;
|
|
1495
1510
|
Blockly.BlockSvg.INPUT_SHAPE_SQUARE=Blockly.BlockSvg.TOP_LEFT_CORNER_START+Blockly.BlockSvg.TOP_LEFT_CORNER+" h "+(12*Blockly.BlockSvg.GRID_UNIT-2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.TOP_RIGHT_CORNER+" v "+(8*Blockly.BlockSvg.GRID_UNIT-2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.BOTTOM_RIGHT_CORNER+" h "+(-12*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.BOTTOM_LEFT_CORNER+" z";Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH=10*Blockly.BlockSvg.GRID_UNIT;
|
|
1496
1511
|
Blockly.BlockSvg.INPUT_SHAPE_ROUND="M "+4*Blockly.BlockSvg.GRID_UNIT+",0 h "+4*Blockly.BlockSvg.GRID_UNIT+" a "+4*Blockly.BlockSvg.GRID_UNIT+" "+4*Blockly.BlockSvg.GRID_UNIT+" 0 0 1 0 "+8*Blockly.BlockSvg.GRID_UNIT+" h "+-4*Blockly.BlockSvg.GRID_UNIT+" a "+4*Blockly.BlockSvg.GRID_UNIT+" "+4*Blockly.BlockSvg.GRID_UNIT+" 0 0 1 0 -"+8*Blockly.BlockSvg.GRID_UNIT+" z";Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.INPUT_SHAPE_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;
|
|
@@ -1498,11 +1513,11 @@ Blockly.BlockSvg.FIELD_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIEL
|
|
|
1498
1513
|
Blockly.BlockSvg.FIELD_TOP_PADDING=.5*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MAX_DISPLAY_LENGTH=Infinity;Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.INLINE_PADDING_Y=1*Blockly.BlockSvg.GRID_UNIT;
|
|
1499
1514
|
Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_INITIAL=12;Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_FINAL=12;Blockly.BlockSvg.FIELD_TEXTINPUT_EXPAND_PAST_TRUNCATION=!1;Blockly.BlockSvg.FIELD_TEXTINPUT_ANIMATE_POSITIONING=!1;
|
|
1500
1515
|
Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING={1:{0:5*Blockly.BlockSvg.GRID_UNIT,1:2*Blockly.BlockSvg.GRID_UNIT,2:5*Blockly.BlockSvg.GRID_UNIT,3:5*Blockly.BlockSvg.GRID_UNIT},2:{0:3*Blockly.BlockSvg.GRID_UNIT,1:3*Blockly.BlockSvg.GRID_UNIT,2:1*Blockly.BlockSvg.GRID_UNIT,3:2*Blockly.BlockSvg.GRID_UNIT},3:{0:2*Blockly.BlockSvg.GRID_UNIT,1:2*Blockly.BlockSvg.GRID_UNIT,2:2*Blockly.BlockSvg.GRID_UNIT,3:2*Blockly.BlockSvg.GRID_UNIT}};Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS=5*Blockly.BlockSvg.GRID_UNIT;
|
|
1501
|
-
Blockly.BlockSvg
|
|
1502
|
-
Blockly.BlockSvg.DEFINE_BLOCK_PADDING_RIGHT=2*Blockly.BlockSvg.GRID_UNIT;
|
|
1503
|
-
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColourTertiary(),b=this.isShadow()&&!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this);b&&this.parentBlock_&&(a=this.parentBlock_.getColourTertiary(),this.inputList[0]&&this.inputList[0].fieldRow[0]&&(this.inputList[0].fieldRow[0]instanceof Blockly.FieldColour||this.inputList[0].fieldRow[0]instanceof Blockly.FieldColourSlider)&&(a=Blockly.Colours.colourPickerStroke));this.
|
|
1504
|
-
b?this.getShadowColour()?this.getShadowColour():this.getColourSecondary():this.getColour();this.
|
|
1505
|
-
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?(this.
|
|
1516
|
+
Object.defineProperty(Blockly.BlockSvg,"TOP_LEFT_CORNER_DEFINE_HAT",{get:function(){return Blockly.theme===Blockly.Themes.CAT_BLOCKS?"c0,-7.1 3.7,-13.3 9.3,-16.9c1.7,-7.5 5.4,-13.2 7.6,-14.2c2.6,-1.3 10,6 14.6,11.1h33c4.6,-5.1 11.9,-12.4 14.6,-11.1c1.9,0.9 4.9,5.2 6.8,11.1c2.6,0,5.2,0,7.8,0":"a "+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+","+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+",-"+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS},enumerable:!0,configurable:!0});
|
|
1517
|
+
Blockly.BlockSvg.TOP_RIGHT_CORNER_DEFINE_HAT="a "+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+","+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS+","+Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS;Blockly.BlockSvg.DEFINE_BLOCK_PADDING_RIGHT=2*Blockly.BlockSvg.GRID_UNIT;
|
|
1518
|
+
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColourTertiary(),b=this.isShadow()&&!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this);b&&this.parentBlock_&&(a=this.parentBlock_.getColourTertiary(),this.inputList[0]&&this.inputList[0].fieldRow[0]&&(this.inputList[0].fieldRow[0]instanceof Blockly.FieldColour||this.inputList[0].fieldRow[0]instanceof Blockly.FieldColourSlider)&&(a=Blockly.Colours.colourPickerStroke));this.blockFrameElement_.setAttribute("stroke",a);a=this.isGlowingBlock_||
|
|
1519
|
+
b?this.getShadowColour()?this.getShadowColour():this.getColourSecondary():this.getColour();this.blockFrameElement_.setAttribute("fill",a);this.blockFrameElement_.setAttribute("fill-opacity",this.getOpacity());for(b=0;a=this.inputList[b];b++)a.outlinePath&&a.outlinePath.setAttribute("fill",this.getColourTertiary());a=this.getIcons();for(b=0;b<a.length;b++)a[b].updateColour();for(b=0;a=this.inputList[b];b++)for(var c=0,d;d=a.fieldRow[c];c++)d.setText(null)};
|
|
1520
|
+
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?(this.blockFrameElement_.setAttribute("filter","url(#"+(this.workspace.options.replacementGlowFilterId||"blocklyReplacementGlowFilter")+")"),Blockly.utils.addClass(this.svgGroup_,"blocklyReplaceable")):(this.blockFrameElement_.removeAttribute("filter"),Blockly.utils.removeClass(this.svgGroup_,"blocklyReplaceable"))};
|
|
1506
1521
|
Blockly.BlockSvg.prototype.highlightShapeForInput=function(a,b){a=this.getInputWithConnection(a);if(!a)throw"No input found for the connection";a.outlinePath&&(b?(a.outlinePath.setAttribute("filter","url(#"+(this.workspace.options.replacementGlowFilterId||"blocklyReplacementGlowFilter")+")"),Blockly.utils.addClass(this.svgGroup_,"blocklyReplaceable")):(a.outlinePath.removeAttribute("filter"),Blockly.utils.removeClass(this.svgGroup_,"blocklyReplaceable")))};
|
|
1507
1522
|
Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c&&(c=c.getHeightWidth(),a+=c.height,a-=Blockly.BlockSvg.NOTCH_HEIGHT,b=Math.max(b,c.width));return{height:a,width:b}};
|
|
1508
1523
|
Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(b=-b);for(var c=this.getIcons(),d=null,e=0;e<c.length;e++)c[e]instanceof Blockly.ScratchBlockComment?d=c[e]:b=c[e].renderIcon(b);b+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X;this.isScratchExtension&&this.outputConnection&&(b+=this.RTL?-Blockly.BlockSvg.GRID_UNIT:Blockly.BlockSvg.GRID_UNIT);c=this.renderCompute_(b);this.renderDraw_(b,c);this.renderMoveConnections_();
|
|
@@ -1520,8 +1535,12 @@ Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y:this.isScratchExtension&&this.previousCon
|
|
|
1520
1535
|
Blockly.BlockSvg.prototype.computeRightEdge_=function(a,b){this.previousConnection||this.nextConnection?a=Math.max(a,Blockly.BlockSvg.MIN_BLOCK_X):this.outputConnection&&(a=this.isShadow()&&!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this)?Math.max(a,Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT):Math.max(a,Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT));b&&(a=Math.max(a,Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT));0<this.insertionMarkerMinWidth_&&(a=Math.max(a,this.insertionMarkerMinWidth_));return a};
|
|
1521
1536
|
Blockly.BlockSvg.prototype.computeOutputPadding_=function(a){if(this.getOutputShape()&&this.outputConnection&&(!this.isShadow()||Blockly.scratchBlocksUtils.isShadowArgumentReporter(this))&&!(1<a.length)){a=a[0];var b=this.getOutputShape();a.paddingStart=0;a.paddingEnd=0;var c=a[0];if(c.fieldRow[0])var d=0;else d=c.connection,d=d.targetConnection?d.targetConnection.getSourceBlock().getOutputShape():d.getOutputShape(),b==Blockly.OUTPUT_SHAPE_HEXAGONAL&&d!=Blockly.OUTPUT_SHAPE_HEXAGONAL&&(c=c.renderHeight-
|
|
1522
1537
|
Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER,a.paddingStart+=c/2);a.paddingStart+=Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[b][d];c=a[a.length-1];c.connection?(d=c.connection,d=d.targetConnection?d.targetConnection.getSourceBlock().getOutputShape():d.getOutputShape(),b==Blockly.OUTPUT_SHAPE_HEXAGONAL&&d!=Blockly.OUTPUT_SHAPE_HEXAGONAL&&(c=c.renderHeight-Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER,a.paddingEnd+=c/2)):d=0;a.paddingEnd+=Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[b][d]}};
|
|
1523
|
-
Blockly.BlockSvg.prototype.
|
|
1524
|
-
|
|
1538
|
+
Blockly.BlockSvg.prototype.renderCatFace_=function(){if(Blockly.theme===Blockly.Themes.CAT_BLOCKS){this.svgPath_.svgFace.setAttribute("fill","#000000");var a=Blockly.utils.createSvgElement("path",{},this.svgFace_);a.setAttribute("d","M25.2-1.1c0.1,0,0.2,0,0.2,0l8.3-2.1l-7-4.8c-0.5-0.3-1.1-0.2-1.4,0.3s-0.2,1.1,0.3,1.4L29-4.1l-4,1c-0.5,0.1-0.9,0.7-0.7,1.2C24.3-1.4,24.7-1.1,25.2-1.1z");a.setAttribute("fill-opacity","0");this.svgPath_.svgFace.closedEye=a;a=Blockly.utils.createSvgElement("path",{},this.svgFace_);
|
|
1539
|
+
a.setAttribute("d","M62.4-1.1c-0.1,0-0.2,0-0.2,0l-8.3-2.1l7-4.8c0.5-0.3,1.1-0.2,1.4,0.3s0.2,1.1-0.3,1.4l-3.4,2.3l4,1c0.5,0.1,0.9,0.7,0.7,1.2C63.2-1.4,62.8-1.1,62.4-1.1z");a.setAttribute("fill-opacity","0");this.svgPath_.svgFace.closedEye2=a;a=Blockly.utils.createSvgElement("circle",{},this.svgFace_);a.setAttribute("cx","59.2");a.setAttribute("cy","-3.3");a.setAttribute("r","3.4");a.setAttribute("fill-opacity","0.6");this.svgPath_.svgFace.eye=a;a=Blockly.utils.createSvgElement("circle",{},this.svgFace_);
|
|
1540
|
+
a.setAttribute("cx","29.1");a.setAttribute("cy","-3.3");a.setAttribute("r","3.4");a.setAttribute("fill-opacity","0.6");this.svgPath_.svgFace.eye2=a;a=Blockly.utils.createSvgElement("path",{},this.svgFace_);a.setAttribute("d","M45.6,0.1c-0.9,0-1.7-0.3-2.3-0.9c-0.6,0.6-1.3,0.9-2.2,0.9c-0.9,0-1.8-0.3-2.3-0.9c-1-1.1-1.1-2.6-1.1-2.8c0-0.5,0.5-1,1-1l0,0c0.6,0,1,0.5,1,1c0,0.4,0.1,1.7,1.4,1.7c0.5,0,0.7-0.2,0.8-0.3c0.3-0.3,0.4-1,0.4-1.3c0-0.1,0-0.1,0-0.2c0-0.5,0.5-1,1-1l0,0c0.5,0,1,0.4,1,1c0,0,0,0.1,0,0.2c0,0.3,0.1,0.9,0.4,1.2C44.8-2.2,45-2,45.5-2s0.7-0.2,0.8-0.3c0.3-0.4,0.4-1.1,0.3-1.3c0-0.5,0.4-1,0.9-1.1c0.5,0,1,0.4,1.1,0.9c0,0.2,0.1,1.8-0.8,2.8C47.5-0.4,46.8,0.1,45.6,0.1z");
|
|
1541
|
+
a.setAttribute("fill-opacity","0.6");this.svgPath_.ear.setAttribute("d","M73.1-15.6c1.7-4.2,4.5-9.1,5.8-8.5c1.6,0.8,5.4,7.9,5,15.4c0,0.6-0.7,0.7-1.1,0.5c-3-1.6-6.4-2.8-8.6-3.6C72.8-12.3,72.4-13.7,73.1-15.6z");this.svgPath_.ear.setAttribute("fill","#FFD5E6");this.svgPath_.ear2.setAttribute("d","M22.4-15.6c-1.7-4.2-4.5-9.1-5.8-8.5c-1.6,0.8-5.4,7.9-5,15.4c0,0.6,0.7,0.7,1.1,0.5c3-1.6,6.4-2.8,8.6-3.6C22.8-12.3,23.2-13.7,22.4-15.6z");this.svgPath_.ear2.setAttribute("fill","#FFD5E6")}};
|
|
1542
|
+
Blockly.BlockSvg.prototype.renderDraw_=function(a,b){this.squareTopLeftCorner_=this.startHat_=!1;this.outputConnection||this.previousConnection||(this.startHat_=this.squareTopLeftCorner_=!0,Blockly.theme===Blockly.Themes.CAT_BLOCKS&&this.initCatStuff(),b.rightEdge=Math.max(b.rightEdge,100));this.edgeShapeWidth_=0;this.edgeShape_=null;if(this.outputConnection){var c=this.getOutputShape();if(c===Blockly.OUTPUT_SHAPE_HEXAGONAL||c===Blockly.OUTPUT_SHAPE_ROUND)this.edgeShapeWidth_=b.bottomEdge/2,this.edgeShape_=
|
|
1543
|
+
c,this.squareTopLeftCorner_=!0}c=[];this.renderDrawTop_(c,b.rightEdge);a=this.renderDrawRight_(c,b,a);this.renderDrawBottom_(c,a);this.renderDrawLeft_(c);a=c.join(" ");this.blockFrameElement_.setAttribute("d",a);Blockly.theme===Blockly.Themes.CAT_BLOCKS&&this.startHat_&&!this.svgFace_.firstChild&&this.renderCatFace_();this.RTL&&this.blockFrameElement_.setAttribute("transform","scale(-1 1)")};
|
|
1525
1544
|
Blockly.BlockSvg.prototype.renderClassify_=function(){var a=[];if(this.outputConnection)this.isShadow_?a.push("argument"):a.push("reporter"),this.edgeShape_===Blockly.OUTPUT_SHAPE_HEXAGONAL?a.push("boolean"):this.edgeShape_===Blockly.OUTPUT_SHAPE_ROUND&&a.push("round");else{for(var b=this.inputList,c=0,d=0,e;e=b[d];d++)e.connection&&e.connection.type===Blockly.NEXT_STATEMENT&&c++;c&&(a.push("c-block"),a.push("c-"+c));this.startHat_?a.push("hat"):c||a.push("stack");this.nextConnection||a.push("end")}this.svgGroup_.setAttribute("data-shapes",
|
|
1526
1545
|
a.join(" "));this.getCategory()&&this.svgGroup_.setAttribute("data-category",this.getCategory())};
|
|
1527
1546
|
Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b){this.type==Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE?(a.push("m 0, 0"),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_DEFINE_HAT)):(this.squareTopLeftCorner_?(a.push("m 0,0"),this.startHat_&&a.push(Blockly.BlockSvg.START_HAT_PATH),this.edgeShapeWidth_&&a.push("m "+this.edgeShapeWidth_+",0")):(a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER)),this.previousConnection&&(a.push("H",Blockly.BlockSvg.NOTCH_START_PADDING),
|
|
@@ -2269,8 +2288,8 @@ Blockly.init_=function(a){var b=a.options,c=a.getParentSvg();Blockly.bindEventWi
|
|
|
2269
2288
|
b.horizontalLayout?(a.scrollY=a.flyout_.height_,b.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM&&(a.scrollY*=-1)):(a.scrollX=a.flyout_.width_,b.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(a.scrollX*=-1)),a.translate(a.scrollX,a.scrollY)));b.hasScrollbars&&(a.scrollbar=new Blockly.ScrollbarPair(a),a.scrollbar.resize());b.hasSounds&&Blockly.inject.loadSounds_(b.pathToMedia,a)};
|
|
2270
2289
|
Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown_),Blockly.bindEvent_(document,"touchend",null,Blockly.longStop_),Blockly.bindEvent_(document,"touchcancel",null,Blockly.longStop_),goog.userAgent.IPAD&&Blockly.bindEventWithChecks_(window,"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())}));Blockly.documentEventsBound_=!0};
|
|
2271
2290
|
Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,a,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,a,!0))};
|
|
2272
|
-
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.cache3dSupported_=null;Blockly.hueToRgb=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
2273
|
-
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};
|
|
2291
|
+
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.cache3dSupported_=null;Blockly.theme_=Blockly.Themes.CLASSIC;Blockly.hueToRgb=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
2292
|
+
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};Object.defineProperty(Blockly,"theme",{get:function(){return Blockly.theme_}});Blockly.setTheme=function(a){Blockly.theme_=a===Blockly.Themes.CAT_BLOCKS?a:Blockly.Themes.CLASSIC};
|
|
2274
2293
|
Blockly.onKeyDown_=function(a){if(!(Blockly.mainWorkspace.options.readOnly||Blockly.utils.isTargetInput(a)||Blockly.mainWorkspace.rendered&&!Blockly.mainWorkspace.isVisible())){var b=!1;if(27==a.keyCode)Blockly.hideChaff(),Blockly.DropDownDiv.hide();else if(8==a.keyCode||46==a.keyCode){a.preventDefault();if(Blockly.mainWorkspace.isDragging())return;Blockly.selected&&Blockly.selected.isDeletable()&&(b=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.mainWorkspace.isDragging())return;Blockly.selected&&
|
|
2275
2294
|
Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(67==a.keyCode?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):88!=a.keyCode||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),b=!0));86==a.keyCode?Blockly.clipboardXml_&&(Blockly.Events.setGroup(!0),a=Blockly.clipboardSource_,a.isFlyout&&(a=a.targetWorkspace),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1)):90==a.keyCode&&(Blockly.hideChaff(),Blockly.mainWorkspace.undo(a.shiftKey))}b&&!Blockly.selected.workspace.isFlyout&&
|
|
2276
2295
|
(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}};Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace};
|
|
@@ -47,8 +47,8 @@ goog.addDependency("../../../" + dir + "/core/block_animations.js", ['Blockly.Bl
|
|
|
47
47
|
goog.addDependency("../../../" + dir + "/core/block_drag_surface.js", ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'goog.asserts', 'goog.math.Coordinate']);
|
|
48
48
|
goog.addDependency("../../../" + dir + "/core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.BlockAnimations', 'Blockly.Events.BlockMove', 'Blockly.Events.DragBlockOutside', 'Blockly.Events.EndBlockDrag', 'Blockly.InsertionMarkerManager', 'goog.math.Coordinate', 'goog.asserts']);
|
|
49
49
|
goog.addDependency("../../../" + dir + "/core/block_events.js", ['Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Events.Change', 'Blockly.Events.Create', 'Blockly.Events.Delete', 'Blockly.Events.Move'], ['Blockly.Events', 'Blockly.Events.Abstract', 'goog.array', 'goog.math.Coordinate']);
|
|
50
|
-
goog.addDependency("../../../" + dir + "/core/block_render_svg_horizontal.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg']);
|
|
51
|
-
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.BlockAnimations', 'Blockly.ContextMenu', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.RenderedConnection', 'Blockly.scratchBlocksUtils', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate']);
|
|
50
|
+
goog.addDependency("../../../" + dir + "/core/block_render_svg_horizontal.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg', 'Blockly.constants']);
|
|
51
|
+
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.BlockAnimations', 'Blockly.ContextMenu', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.RenderedConnection', 'Blockly.scratchBlocksUtils', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.constants', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate']);
|
|
52
52
|
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldColourSlider', 'Blockly.FieldDropdown', 'Blockly.FieldIconMenu', 'Blockly.FieldImage', 'Blockly.FieldNote', 'Blockly.FieldTextInput', 'Blockly.FieldTextInputRemovable', 'Blockly.FieldTextDropdown', 'Blockly.FieldNumber', 'Blockly.FieldNumberDropdown', 'Blockly.FieldMatrix', 'Blockly.FieldVariable', 'Blockly.FieldVerticalSeparator', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.ScratchMsgs', 'Blockly.Toolbox', 'Blockly.Touch', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color']);
|
|
53
53
|
goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []);
|
|
54
54
|
goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Touch', 'Blockly.Workspace', 'goog.dom', 'goog.math.Coordinate', 'goog.userAgent']);
|
|
@@ -47,8 +47,8 @@ goog.addDependency("../../../" + dir + "/core/block_animations.js", ['Blockly.Bl
|
|
|
47
47
|
goog.addDependency("../../../" + dir + "/core/block_drag_surface.js", ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'goog.asserts', 'goog.math.Coordinate']);
|
|
48
48
|
goog.addDependency("../../../" + dir + "/core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.BlockAnimations', 'Blockly.Events.BlockMove', 'Blockly.Events.DragBlockOutside', 'Blockly.Events.EndBlockDrag', 'Blockly.InsertionMarkerManager', 'goog.math.Coordinate', 'goog.asserts']);
|
|
49
49
|
goog.addDependency("../../../" + dir + "/core/block_events.js", ['Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Events.Change', 'Blockly.Events.Create', 'Blockly.Events.Delete', 'Blockly.Events.Move'], ['Blockly.Events', 'Blockly.Events.Abstract', 'goog.array', 'goog.math.Coordinate']);
|
|
50
|
-
goog.addDependency("../../../" + dir + "/core/block_render_svg_vertical.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg', 'Blockly.scratchBlocksUtils', 'Blockly.utils']);
|
|
51
|
-
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.BlockAnimations', 'Blockly.ContextMenu', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.RenderedConnection', 'Blockly.scratchBlocksUtils', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate']);
|
|
50
|
+
goog.addDependency("../../../" + dir + "/core/block_render_svg_vertical.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg', 'Blockly.scratchBlocksUtils', 'Blockly.utils', 'Blockly.constants']);
|
|
51
|
+
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.BlockAnimations', 'Blockly.ContextMenu', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.RenderedConnection', 'Blockly.scratchBlocksUtils', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.constants', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate']);
|
|
52
52
|
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldColourSlider', 'Blockly.FieldDropdown', 'Blockly.FieldIconMenu', 'Blockly.FieldImage', 'Blockly.FieldNote', 'Blockly.FieldTextInput', 'Blockly.FieldTextInputRemovable', 'Blockly.FieldTextDropdown', 'Blockly.FieldNumber', 'Blockly.FieldNumberDropdown', 'Blockly.FieldMatrix', 'Blockly.FieldVariable', 'Blockly.FieldVerticalSeparator', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.ScratchMsgs', 'Blockly.Toolbox', 'Blockly.Touch', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color']);
|
|
53
53
|
goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []);
|
|
54
54
|
goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Touch', 'Blockly.Workspace', 'goog.dom', 'goog.math.Coordinate', 'goog.userAgent']);
|
package/blocks_compressed.js
CHANGED
|
@@ -6,7 +6,7 @@ Blockly.constants={};Blockly.DRAG_RADIUS=3;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly
|
|
|
6
6
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
7
7
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.Categories={motion:"motion",looks:"looks",sound:"sounds",pen:"pen",data:"data",dataLists:"data-lists",event:"events",control:"control",sensing:"sensing",operators:"operators",more:"more"};Blockly.DELETE_AREA_NONE=null;
|
|
8
8
|
Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.NEW_BROADCAST_MESSAGE_ID="NEW_BROADCAST_MESSAGE_ID";Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE="broadcast_msg";Blockly.LIST_VARIABLE_TYPE="list";Blockly.SCALAR_VARIABLE_TYPE="";Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE="procedures_definition";
|
|
9
|
-
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};
|
|
9
|
+
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Themes={CLASSIC:"classic",CAT_BLOCKS:"catblocks"};
|
|
10
10
|
Blockly.Blocks.colour={};function randomColour(){return"#"+("00000"+Math.floor(Math.random()*Math.pow(2,24)).toString(16)).substr(-6)}Blockly.Blocks.colour_picker={init:function(){this.jsonInit({message0:"%1",args0:[{type:"field_colour_slider",name:"COLOUR",colour:randomColour()}],outputShape:Blockly.OUTPUT_SHAPE_ROUND,output:"Colour"})}};/*
|
|
11
11
|
|
|
12
12
|
Visual Blocks Editor
|
|
@@ -64,4 +64,4 @@ Blockly.constants={};Blockly.DRAG_RADIUS=3;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly
|
|
|
64
64
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
65
65
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.Categories={motion:"motion",looks:"looks",sound:"sounds",pen:"pen",data:"data",dataLists:"data-lists",event:"events",control:"control",sensing:"sensing",operators:"operators",more:"more"};Blockly.DELETE_AREA_NONE=null;
|
|
66
66
|
Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.NEW_BROADCAST_MESSAGE_ID="NEW_BROADCAST_MESSAGE_ID";Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE="broadcast_msg";Blockly.LIST_VARIABLE_TYPE="list";Blockly.SCALAR_VARIABLE_TYPE="";Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE="procedures_definition";
|
|
67
|
-
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};
|
|
67
|
+
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Themes={CLASSIC:"classic",CAT_BLOCKS:"catblocks"};
|
|
@@ -28,7 +28,7 @@ Blockly.constants={};Blockly.DRAG_RADIUS=3;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly
|
|
|
28
28
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
29
29
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.Categories={motion:"motion",looks:"looks",sound:"sounds",pen:"pen",data:"data",dataLists:"data-lists",event:"events",control:"control",sensing:"sensing",operators:"operators",more:"more"};Blockly.DELETE_AREA_NONE=null;
|
|
30
30
|
Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.NEW_BROADCAST_MESSAGE_ID="NEW_BROADCAST_MESSAGE_ID";Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE="broadcast_msg";Blockly.LIST_VARIABLE_TYPE="list";Blockly.SCALAR_VARIABLE_TYPE="";Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE="procedures_definition";
|
|
31
|
-
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};
|
|
31
|
+
Blockly.PROCEDURES_PROTOTYPE_BLOCK_TYPE="procedures_prototype";Blockly.PROCEDURES_CALL_BLOCK_TYPE="procedures_call";Blockly.StatusButtonState={READY:"ready",NOT_READY:"not ready"};Blockly.Themes={CLASSIC:"classic",CAT_BLOCKS:"catblocks"};
|
|
32
32
|
Blockly.ScratchBlocks={};Blockly.ScratchBlocks.VerticalExtensions={};Blockly.ScratchBlocks.VerticalExtensions.colourHelper=function(a){var b=Blockly.Colours[a];if(!(b&&b.primary&&b.secondary&&b.tertiary&&b.quaternary))throw Error('Could not find colours for category "'+a+'"');return function(){this.setColourFromRawValues_(b.primary,b.secondary,b.tertiary,b.quaternary)}};
|
|
33
33
|
Blockly.ScratchBlocks.VerticalExtensions.COLOUR_TEXTFIELD=function(){this.setColourFromRawValues_(Blockly.Colours.textField,Blockly.Colours.textField,Blockly.Colours.textField,Blockly.Colours.textField)};Blockly.ScratchBlocks.VerticalExtensions.SHAPE_STATEMENT=function(){this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null)};Blockly.ScratchBlocks.VerticalExtensions.SHAPE_HAT=function(){this.setInputsInline(!0);this.setNextStatement(!0,null)};
|
|
34
34
|
Blockly.ScratchBlocks.VerticalExtensions.SHAPE_END=function(){this.setInputsInline(!0);this.setPreviousStatement(!0,null)};Blockly.ScratchBlocks.VerticalExtensions.OUTPUT_NUMBER=function(){this.setInputsInline(!0);this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setOutput(!0,"Number")};Blockly.ScratchBlocks.VerticalExtensions.OUTPUT_STRING=function(){this.setInputsInline(!0);this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setOutput(!0,"String")};
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
goog.provide('Blockly.BlockSvg.render');
|
|
28
28
|
|
|
29
29
|
goog.require('Blockly.BlockSvg');
|
|
30
|
+
goog.require('Blockly.constants');
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
// UI constants for rendering blocks.
|
|
@@ -311,14 +312,14 @@ Blockly.BlockSvg.prototype.updateColour = function() {
|
|
|
311
312
|
var strokeColour = this.getColourTertiary();
|
|
312
313
|
|
|
313
314
|
// Render block stroke
|
|
314
|
-
this.
|
|
315
|
+
this.blockFrameElement_.setAttribute('stroke', strokeColour);
|
|
315
316
|
|
|
316
317
|
// Render block fill
|
|
317
318
|
var fillColour = (this.isGlowingBlock_) ? this.getColourSecondary() : this.getColour();
|
|
318
|
-
this.
|
|
319
|
+
this.blockFrameElement_.setAttribute('fill', fillColour);
|
|
319
320
|
|
|
320
321
|
// Render opacity
|
|
321
|
-
this.
|
|
322
|
+
this.blockFrameElement_.setAttribute('fill-opacity', this.getOpacity());
|
|
322
323
|
|
|
323
324
|
// Bump every dropdown to change its colour.
|
|
324
325
|
for (var x = 0, input; input = this.inputList[x]; x++) {
|
|
@@ -337,11 +338,11 @@ Blockly.BlockSvg.prototype.highlightForReplacement = function(add) {
|
|
|
337
338
|
if (add) {
|
|
338
339
|
var replacementGlowFilterId = this.workspace.options.replacementGlowFilterId
|
|
339
340
|
|| 'blocklyReplacementGlowFilter';
|
|
340
|
-
this.
|
|
341
|
+
this.blockFrameElement_.setAttribute('filter', 'url(#' + replacementGlowFilterId + ')');
|
|
341
342
|
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
|
342
343
|
'blocklyReplaceable');
|
|
343
344
|
} else {
|
|
344
|
-
this.
|
|
345
|
+
this.blockFrameElement_.removeAttribute('filter');
|
|
345
346
|
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
|
346
347
|
'blocklyReplaceable');
|
|
347
348
|
}
|
|
@@ -545,12 +546,12 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(metrics) {
|
|
|
545
546
|
this.renderDrawTop_(steps, connectionsXY, metrics);
|
|
546
547
|
|
|
547
548
|
var pathString = steps.join(' ');
|
|
548
|
-
this.
|
|
549
|
+
this.blockFrameElement_.setAttribute('d', pathString);
|
|
549
550
|
|
|
550
551
|
if (this.RTL) {
|
|
551
552
|
// Mirror the block's path.
|
|
552
553
|
// This is awesome.
|
|
553
|
-
this.
|
|
554
|
+
this.blockFrameElement_.setAttribute('transform', 'scale(-1 1)');
|
|
554
555
|
}
|
|
555
556
|
|
|
556
557
|
// Horizontal blocks have a single Image Field that is specially positioned
|