Renderers define which paths a block has. (#2981)

* Move render elements into a path object.
This commit is contained in:
Rachel Fenichel
2019-09-16 12:13:32 -07:00
committed by Sam El-Husseini
parent e05e26ab45
commit 77185906d8
20 changed files with 376 additions and 198 deletions

View File

@@ -209,9 +209,8 @@ Blockly.Connection.prototype.targetBlock=function(){return this.isConnected()?th
Blockly.Connection.prototype.setCheck=function(a){a?(Array.isArray(a)||(a=[a]),this.check_=a,this.onCheckChanged_()):this.check_=null;return this};Blockly.Connection.prototype.getCheck=function(){return this.check_};Blockly.Connection.prototype.setShadowDom=function(a){this.shadowDom_=a};Blockly.Connection.prototype.getShadowDom=function(){return this.shadowDom_};Blockly.Connection.prototype.neighbours_=function(a){return[]};
Blockly.Connection.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)if(c[d].connection===this){a=c[d];break}return a};
Blockly.Connection.prototype.toString=function(){var a=this.sourceBlock_;if(a)if(a.outputConnection==this)var b="Output Connection of ";else if(a.previousConnection==this)b="Previous Connection of ";else if(a.nextConnection==this)b="Next Connection of ";else{b=null;for(var c=0,d;d=a.inputList[c];c++)if(d.connection==this){b=d;break}if(b)b='Input "'+b.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";
return b+a.toDevString()};Blockly.blockRendering={};Blockly.blockRendering.renderer_=null;Blockly.blockRendering.rendererMap_={};Blockly.blockRendering.useDebugger=!1;Blockly.blockRendering.register=function(a,b){if(Blockly.blockRendering.rendererMap_[a])throw Error("Renderer has already been registered.");Blockly.blockRendering.rendererMap_[a]=b};Blockly.blockRendering.startDebugger=function(){Blockly.blockRendering.useDebugger_=!0};Blockly.blockRendering.stopDebugger=function(){Blockly.blockRendering.useDebugger_=!1};
Blockly.blockRendering.init=function(a){if(!Blockly.blockRendering.rendererMap_[a])throw Error("Renderer not registered: ",a);var b=function(){b.superClass_.constructor.call(this)};Blockly.utils.object.inherits(b,Blockly.blockRendering.rendererMap_[a]);Blockly.blockRendering.renderer=new b;Blockly.blockRendering.renderer.init()};Blockly.blockRendering.render=function(a){Blockly.blockRendering.renderer.render(a)};Blockly.blockRendering.getRenderer=function(){return Blockly.blockRendering.renderer};
Blockly.blockRendering.getConstants=function(){return Blockly.blockRendering.renderer.constants};Blockly.ConnectionDB=function(){this.connections_=[]};Blockly.ConnectionDB.prototype.addConnection=function(a){if(a.inDB_)throw Error("Connection already in database.");if(!a.getSourceBlock().isInFlyout){var b=this.findPositionForConnection_(a);this.connections_.splice(b,0,a);a.inDB_=!0}};
return b+a.toDevString()};Blockly.blockRendering={};Blockly.blockRendering.rendererMap_={};Blockly.blockRendering.useDebugger=!1;Blockly.blockRendering.register=function(a,b){if(Blockly.blockRendering.rendererMap_[a])throw Error("Renderer has already been registered.");Blockly.blockRendering.rendererMap_[a]=b};Blockly.blockRendering.startDebugger=function(){Blockly.blockRendering.useDebugger=!0};Blockly.blockRendering.stopDebugger=function(){Blockly.blockRendering.useDebugger=!1};
Blockly.blockRendering.init=function(a){if(!Blockly.blockRendering.rendererMap_[a])throw Error("Renderer not registered: ",a);var b=function(){b.superClass_.constructor.call(this)};Blockly.utils.object.inherits(b,Blockly.blockRendering.rendererMap_[a]);a=new b;a.init();return a};Blockly.ConnectionDB=function(){this.connections_=[]};Blockly.ConnectionDB.prototype.addConnection=function(a){if(a.inDB_)throw Error("Connection already in database.");if(!a.getSourceBlock().isInFlyout){var b=this.findPositionForConnection_(a);this.connections_.splice(b,0,a);a.inDB_=!0}};
Blockly.ConnectionDB.prototype.findConnection=function(a){if(!this.connections_.length)return-1;var b=this.findPositionForConnection_(a);if(b>=this.connections_.length)return-1;for(var c=a.y_,d=b;0<=d&&this.connections_[d].y_==c;){if(this.connections_[d]==a)return d;d--}for(;b<this.connections_.length&&this.connections_[b].y_==c;){if(this.connections_[b]==a)return b;b++}return-1};
Blockly.ConnectionDB.prototype.findPositionForConnection_=function(a){if(!this.connections_.length)return 0;for(var b=0,c=this.connections_.length;b<c;){var d=Math.floor((b+c)/2);if(this.connections_[d].y_<a.y_)b=d+1;else if(this.connections_[d].y_>a.y_)c=d;else{b=d;break}}return b};
Blockly.ConnectionDB.prototype.removeConnection_=function(a){if(!a.inDB_)throw Error("Connection not in database.");var b=this.findConnection(a);if(-1==b)throw Error("Unable to find connection in connectionDB.");a.inDB_=!1;this.connections_.splice(b,1)};
@@ -247,7 +246,7 @@ Blockly.RenderedConnection.prototype.bumpAwayFrom_=function(a){if(!this.sourceBl
(e=a.x_-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_);b.moveBy(e,f);d||b.removeSelect()}}};Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.inDB_&&this.db_.removeConnection_(this);this.x_=a;this.y_=b;this.hidden_||this.db_.addConnection(this)};Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x_+a,this.y_+b)};Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)};
Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b};Blockly.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_};
Blockly.RenderedConnection.prototype.tighten_=function(){var a=this.targetConnection.x_-this.x_,b=this.targetConnection.y_-this.y_;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=Blockly.utils.getRelativeXY(d);c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")");c.moveConnections_(-a,-b)}};Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)};
Blockly.RenderedConnection.prototype.highlight=function(){var a=this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?Blockly.utils.svgPaths.moveBy(0,-5)+Blockly.utils.svgPaths.lineOnAxis("v",5)+Blockly.blockRendering.getConstants().PUZZLE_TAB.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",5):Blockly.utils.svgPaths.moveBy(-5,0)+Blockly.utils.svgPaths.lineOnAxis("h",5)+Blockly.blockRendering.getConstants().NOTCH.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",5);var b=this.sourceBlock_.getRelativeToSurfaceXY();
Blockly.RenderedConnection.prototype.highlight=function(){var a=this.sourceBlock_.workspace.getRenderer().getConstants();a=this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?Blockly.utils.svgPaths.moveBy(0,-5)+Blockly.utils.svgPaths.lineOnAxis("v",5)+a.PUZZLE_TAB.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",5):Blockly.utils.svgPaths.moveBy(-5,0)+Blockly.utils.svgPaths.lineOnAxis("h",5)+a.NOTCH.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",5);var b=this.sourceBlock_.getRelativeToSurfaceXY();
Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.x_-b.x)+","+(this.y_-b.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())};
Blockly.RenderedConnection.prototype.unhideAll=function(){this.setHidden(!1);var a=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return a;var b=this.targetBlock();if(b){if(b.isCollapsed()){var c=[];b.outputConnection&&c.push(b.outputConnection);b.nextConnection&&c.push(b.nextConnection);b.previousConnection&&c.push(b.previousConnection)}else c=b.getConnections_(!0);for(var d=0;d<c.length;d++)a.push.apply(a,c[d].unhideAll());a.length||(a[0]=b)}return a};
Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_);delete Blockly.Connection.highlightedPath_};Blockly.RenderedConnection.prototype.setHidden=function(a){(this.hidden_=a)&&this.inDB_?this.db_.removeConnection_(this):a||this.inDB_||this.db_.addConnection(this)};
@@ -457,12 +456,12 @@ Blockly.ZoomControls.prototype.createZoomResetSvg_=function(a){var b=this.worksp
a+")"},this.zoomResetGroup_);a.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",b.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(a,"mousedown",null,function(a){b.markFocused();b.setScale(b.options.zoomOptions.startScale);b.beginCanvasTransition();b.scrollCenter();setTimeout(b.endCanvasTransition.bind(b),500);Blockly.Touch.clearTouchIdentifier();a.stopPropagation();a.preventDefault()})};
Blockly.WorkspaceSvg=function(a,b,c){Blockly.WorkspaceSvg.superClass_.constructor.call(this,a);this.getMetrics=a.getMetrics||Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;this.setMetrics=a.setMetrics||Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;this.connectionDBList=Blockly.ConnectionDB.init();b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=this.workspaceDragSurface_&&Blockly.utils.is3dSupported();this.highlightedBlocks_=[];this.audioManager_=
new Blockly.WorkspaceAudio(a.parentWorkspace);this.grid_=this.options.gridPattern?new Blockly.Grid(a.gridPattern,a.gridOptions):null;Blockly.Variables&&Blockly.Variables.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME,Blockly.Variables.flyoutCategory);Blockly.VariablesDynamic&&Blockly.VariablesDynamic.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME,Blockly.VariablesDynamic.flyoutCategory);Blockly.Procedures&&Blockly.Procedures.flyoutCategory&&
this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Procedures.flyoutCategory);Blockly.blockRendering.init(this.options.renderer||"geras")};Blockly.utils.object.inherits(Blockly.WorkspaceSvg,Blockly.Workspace);Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null;Blockly.WorkspaceSvg.prototype.rendered=!0;Blockly.WorkspaceSvg.prototype.isVisible_=!0;Blockly.WorkspaceSvg.prototype.isFlyout=!1;Blockly.WorkspaceSvg.prototype.isMutator=!1;
this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Procedures.flyoutCategory);this.renderer_=Blockly.blockRendering.init(this.options.renderer||"geras")};Blockly.utils.object.inherits(Blockly.WorkspaceSvg,Blockly.Workspace);Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null;Blockly.WorkspaceSvg.prototype.rendered=!0;Blockly.WorkspaceSvg.prototype.isVisible_=!0;Blockly.WorkspaceSvg.prototype.isFlyout=!1;Blockly.WorkspaceSvg.prototype.isMutator=!1;
Blockly.WorkspaceSvg.prototype.resizesEnabled_=!0;Blockly.WorkspaceSvg.prototype.scrollX=0;Blockly.WorkspaceSvg.prototype.scrollY=0;Blockly.WorkspaceSvg.prototype.startScrollX=0;Blockly.WorkspaceSvg.prototype.startScrollY=0;Blockly.WorkspaceSvg.prototype.dragDeltaXY_=null;Blockly.WorkspaceSvg.prototype.scale=1;Blockly.WorkspaceSvg.prototype.trashcan=null;Blockly.WorkspaceSvg.prototype.scrollbar=null;Blockly.WorkspaceSvg.prototype.flyout_=null;Blockly.WorkspaceSvg.prototype.toolbox_=null;
Blockly.WorkspaceSvg.prototype.currentGesture_=null;Blockly.WorkspaceSvg.prototype.blockDragSurface_=null;Blockly.WorkspaceSvg.prototype.workspaceDragSurface_=null;Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_=!1;Blockly.WorkspaceSvg.prototype.isDragSurfaceActive_=!1;Blockly.WorkspaceSvg.prototype.injectionDiv_=null;Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_=null;Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_={};
Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_={};Blockly.WorkspaceSvg.prototype.configureContextMenu=null;Blockly.WorkspaceSvg.prototype.targetWorkspace=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTM_=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_=!0;Blockly.WorkspaceSvg.prototype.setCursor=function(a){this.cursor_&&this.cursor_.getDrawer().dispose();this.cursor_=a;this.cursor_.setDrawer(new Blockly.CursorSvg(this,!1));this.svgGroup_&&this.svgGroup_.appendChild(this.cursor_.getDrawer().createDom())};
Blockly.WorkspaceSvg.prototype.setMarker=function(a){this.marker_&&this.marker_.getDrawer().dispose();this.marker_=a;this.marker_.setDrawer(new Blockly.CursorSvg(this,!0));this.svgGroup_&&this.svgGroup_.appendChild(this.marker_.getDrawer().createDom())};Blockly.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_};
Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0};Blockly.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_};
Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_={};Blockly.WorkspaceSvg.prototype.configureContextMenu=null;Blockly.WorkspaceSvg.prototype.targetWorkspace=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTM_=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_=!0;Blockly.WorkspaceSvg.prototype.getRenderer=function(){return this.renderer_};
Blockly.WorkspaceSvg.prototype.setCursor=function(a){this.cursor_&&this.cursor_.getDrawer().dispose();this.cursor_=a;this.cursor_.setDrawer(new Blockly.CursorSvg(this,!1));this.svgGroup_&&this.svgGroup_.appendChild(this.cursor_.getDrawer().createDom())};Blockly.WorkspaceSvg.prototype.setMarker=function(a){this.marker_&&this.marker_.getDrawer().dispose();this.marker_=a;this.marker_.setDrawer(new Blockly.CursorSvg(this,!0));this.svgGroup_&&this.svgGroup_.appendChild(this.marker_.getDrawer().createDom())};
Blockly.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_};Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0};Blockly.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_};
Blockly.WorkspaceSvg.prototype.getSvgXY=function(a){var b=0,c=0,d=1;if(Blockly.utils.dom.containsNode(this.getCanvas(),a)||Blockly.utils.dom.containsNode(this.getBubbleCanvas(),a))d=this.scale;do{var e=Blockly.utils.getRelativeXY(a);if(a==this.getCanvas()||a==this.getBubbleCanvas())d=1;b+=e.x*d;c+=e.y*d;a=a.parentNode}while(a&&a!=this.getParentSvg());return new Blockly.utils.Coordinate(b,c)};Blockly.WorkspaceSvg.prototype.getOriginOffsetInPixels=function(){return Blockly.utils.getInjectionDivXY_(this.svgBlockCanvas_)};
Blockly.WorkspaceSvg.prototype.getInjectionDiv=function(){if(!this.injectionDiv_)for(var a=this.svgGroup_;a;){if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv_=a;break}a=a.parentNode}return this.injectionDiv_};Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper=function(a){this.resizeHandlerWrapper_=a};
Blockly.WorkspaceSvg.prototype.createDom=function(a){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyWorkspace"},null);a&&(this.svgBackground_=Blockly.utils.dom.createSvgElement("rect",{height:"100%",width:"100%","class":a},this.svgGroup_),"blocklyMainBackground"==a&&this.grid_&&(this.svgBackground_.style.fill="url(#"+this.grid_.getPatternId()+")"));this.svgBlockCanvas_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyBlockCanvas"},this.svgGroup_);this.svgBubbleCanvas_=
@@ -683,9 +682,9 @@ Blockly.ContextMenu.blockDeleteOption=function(a){var b=a.getDescendants(!1).len
Blockly.ContextMenu.blockDuplicateOption=function(a){var b=a.isDuplicatable();return{text:Blockly.Msg.DUPLICATE_BLOCK,enabled:b,callback:function(){Blockly.duplicate_(a)}}};Blockly.ContextMenu.blockCommentOption=function(a){var b={enabled:!Blockly.utils.userAgent.IE};a.comment?(b.text=Blockly.Msg.REMOVE_COMMENT,b.callback=function(){a.setCommentText(null)}):(b.text=Blockly.Msg.ADD_COMMENT,b.callback=function(){a.setCommentText("")});return b};
Blockly.ContextMenu.commentDeleteOption=function(a){return{text:Blockly.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){Blockly.Events.setGroup(!0);a.dispose(!0,!0);Blockly.Events.setGroup(!1)}}};Blockly.ContextMenu.commentDuplicateOption=function(a){return{text:Blockly.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){Blockly.duplicate_(a)}}};
Blockly.ContextMenu.workspaceCommentOption=function(a,b){var c={enabled:!Blockly.utils.userAgent.IE};c.text=Blockly.Msg.ADD_COMMENT;c.callback=function(){var c=new Blockly.WorkspaceCommentSvg(a,Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE),e=a.getInjectionDiv().getBoundingClientRect();e=new Blockly.utils.Coordinate(b.clientX-e.left,b.clientY-e.top);var f=a.getOriginOffsetInPixels();e=Blockly.utils.Coordinate.difference(e,
f);e.scale(1/a.scale);c.moveBy(e.x,e.y);a.rendered&&(c.initSvg(),c.render(),c.select())};return c};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{},null);this.svgGroup_.translate_="";this.svgPathDark_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgGroup_);this.svgPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPathLight_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgGroup_);this.svgPath_.tooltip=this;this.rendered=!1;
this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c);this.svgGroup_.dataset&&(this.svgGroup_.dataset.id=this.id)};Blockly.utils.object.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.warningTextDb_=null;Blockly.BlockSvg.INLINE=-1;
Blockly.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";
f);e.scale(1/a.scale);c.moveBy(e.x,e.y);a.rendered&&(c.initSvg(),c.render(),c.select())};return c};Blockly.blockRendering.IPathObject=function(a){};Blockly.blockRendering.PathObject=function(a){this.svgRoot=a;this.svgPath=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath"},this.svgRoot);this.svgPathLight=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgRoot);this.svgPathDark=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot)};
Blockly.blockRendering.PathObject.prototype.setPaths=function(a){this.svgPath.setAttribute("d",a);this.RTL&&this.svgPath.setAttribute("transform","scale(-1 1)");this.svgPathLight.style.display="none";this.svgPathDark.style.display="none"};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{},null);this.svgGroup_.translate_="";this.pathObject=a.getRenderer().makePathObject(this.svgGroup_);this.svgPathDark_=this.pathObject.svgPathDark||null;this.svgPath_=this.pathObject.svgPath||null;this.svgPathLight_=this.pathObject.svgPathLight||null;this.svgPath_.tooltip=this;this.rendered=!1;this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.Tooltip.bindMouseEvents(this.svgPath_);
Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c);this.svgGroup_.dataset&&(this.svgGroup_.dataset.id=this.id)};Blockly.utils.object.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.warningTextDb_=null;Blockly.BlockSvg.INLINE=-1;Blockly.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";
Blockly.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var a=0,b;b=this.inputList[a];a++)b.init();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",this,this.onMouseDown_);this.eventsInit_=!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};
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()}};
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()}};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null;
@@ -727,10 +726,9 @@ Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.sup
Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.RenderedConnection(this,a)};
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))}}};
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.prototype.positionNearConnection=function(a,b){a.type!=Blockly.NEXT_STATEMENT&&a.type!=Blockly.INPUT_VALUE||this.moveBy(b.x_-a.x_,b.y_-a.y_)};
Blockly.BlockSvg.prototype.render=function(a){Blockly.utils.dom.startTextWidthCache();this.rendered=!0;Blockly.blockRendering.render(this);this.updateConnectionLocations_();!1!==a&&((a=this.getParent())?a.render(!0):this.workspace.resizeContents());Blockly.utils.dom.stopTextWidthCache()};
Blockly.BlockSvg.prototype.updateConnectionLocations_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten_())};Blockly.BlockSvg.render={};Blockly.BlockSvg.PathObject=function(){this.steps=[];this.highlightSteps=[];this.inlineSteps=[];this.highlightInlineSteps=[]};Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.START_HAT=!1;Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c&&(c=c.getHeightWidth(),a+=c.height-4,b=Math.max(b,c.width));return{height:a,width:b}};
Blockly.BlockSvg.prototype.setPaths_=function(a){var b=a.steps.join(" ")+"\n"+a.inlineSteps.join(" ");this.svgPath_.setAttribute("d",b);this.svgPathDark_.setAttribute("d",b);b=a.highlightSteps.join(" ")+"\n"+a.highlightInlineSteps.join(" ");this.svgPathLight_.setAttribute("d",b);this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))};
Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyReplaceable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyReplaceable")};
Blockly.BlockSvg.prototype.render=function(a){Blockly.utils.dom.startTextWidthCache();this.rendered=!0;this.workspace.getRenderer().render(this);this.updateConnectionLocations_();!1!==a&&((a=this.getParent())?a.render(!0):this.workspace.resizeContents());Blockly.utils.dom.stopTextWidthCache()};
Blockly.BlockSvg.prototype.updateConnectionLocations_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten_())};Blockly.BlockSvg.render={};Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.START_HAT=!1;Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c&&(c=c.getHeightWidth(),a+=c.height-4,b=Math.max(b,c.width));return{height:a,width:b}};Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyReplaceable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyReplaceable")};
Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.DIV_=null;Blockly.DropDownDiv.boundsElement_=null;Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.positionToField_=null;Blockly.DropDownDiv.ARROW_SIZE=16;Blockly.DropDownDiv.BORDER_SIZE=1;Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING=12;Blockly.DropDownDiv.PADDING_Y=16;Blockly.DropDownDiv.ANIMATION_TIME=.25;Blockly.DropDownDiv.animateOutTimer_=null;Blockly.DropDownDiv.onHide_=0;
Blockly.DropDownDiv.createDom=function(){if(!Blockly.DropDownDiv.DIV_){var a=document.createElement("div");a.className="blocklyDropDownDiv";document.body.appendChild(a);Blockly.DropDownDiv.DIV_=a;var b=document.createElement("div");b.className="blocklyDropDownContent";a.appendChild(b);Blockly.DropDownDiv.content_=b;b=document.createElement("div");b.className="blocklyDropDownArrow";a.appendChild(b);Blockly.DropDownDiv.arrow_=b;Blockly.DropDownDiv.DIV_.style.opacity=0;Blockly.DropDownDiv.DIV_.style.transition=
"transform "+Blockly.DropDownDiv.ANIMATION_TIME+"s, opacity "+Blockly.DropDownDiv.ANIMATION_TIME+"s";a.addEventListener("focusin",function(){Blockly.utils.dom.addClass(a,"focused")});a.addEventListener("focusout",function(){Blockly.utils.dom.removeClass(a,"focused")})}};Blockly.DropDownDiv.setBoundsElement=function(a){Blockly.DropDownDiv.boundsElement_=a};Blockly.DropDownDiv.getContentDiv=function(){return Blockly.DropDownDiv.content_};
@@ -875,46 +873,46 @@ Blockly.blockRendering.Types.isInlineInput=function(a){return a.type&Blockly.blo
Blockly.blockRendering.Types.isPreviousOrNextConnection=function(a){return a.type&(Blockly.blockRendering.Types.PREVIOUS_CONNECTION|Blockly.blockRendering.Types.NEXT_CONNECTION)};Blockly.blockRendering.Types.isLeftRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_ROUND_CORNER};Blockly.blockRendering.Types.isRightRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_ROUND_CORNER};
Blockly.blockRendering.Types.isLeftSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_SQUARE_CORNER};Blockly.blockRendering.Types.isRightSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER};Blockly.blockRendering.Types.isCorner=function(a){return a.type&Blockly.blockRendering.Types.CORNER};Blockly.blockRendering.Types.isJaggedEdge=function(a){return a.type&Blockly.blockRendering.Types.JAGGED_EDGE};
Blockly.blockRendering.Types.isRow=function(a){return a.type&Blockly.blockRendering.Types.ROW};Blockly.blockRendering.Types.isBetweenRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.BETWEEN_ROW_SPACER};Blockly.blockRendering.Types.isTopRow=function(a){return a.type&Blockly.blockRendering.Types.TOP_ROW};Blockly.blockRendering.Types.isBottomRow=function(a){return a.type&Blockly.blockRendering.Types.BOTTOM_ROW};
Blockly.blockRendering.Types.isTopOrBottomRow=function(a){return a.type&(Blockly.blockRendering.Types.TOP_ROW|Blockly.blockRendering.Types.BOTTOM_ROW)};Blockly.blockRendering.Types.isInputRow=function(a){return a.type&Blockly.blockRendering.Types.INPUT_ROW};Blockly.blockRendering.Measurable=function(){this.height=this.width=0;this.type=Blockly.blockRendering.Types.NONE;this.centerline=this.xPos=0;this.constants_=Blockly.blockRendering.getConstants();this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};Blockly.blockRendering.Connection=function(a){Blockly.blockRendering.Connection.superClass_.constructor.call(this);this.connectionModel=a;this.shape=this.constants_.shapeFor(a);this.type|=Blockly.blockRendering.Types.CONNECTION};Blockly.utils.object.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable);
Blockly.blockRendering.OutputConnection=function(a){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.OUTPUT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.startX=this.width};Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.OutputConnection.prototype.isDynamic=function(){return this.shape.isDynamic};
Blockly.blockRendering.PreviousConnection=function(a){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.PREVIOUS_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.NextConnection=function(a){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.NEXT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.InputConnection=function(a){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a.connection);this.type|=Blockly.blockRendering.Types.INPUT;this.input=a;this.align=a.align;if(this.connectedBlock=a.connection&&a.connection.targetBlock()?a.connection.targetBlock():null){var b=this.connectedBlock.getHeightWidth();this.connectedBlockWidth=b.width;this.connectedBlockHeight=b.height}else this.connectedBlockHeight=this.connectedBlockWidth=0;this.connection=a.connection;
this.connectionOffsetY=this.connectionOffsetX=0};Blockly.utils.object.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.InlineInput=function(a){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.INLINE_INPUT;this.connectedBlock?(this.width=this.connectedBlockWidth+this.constants_.DARK_PATH_OFFSET,this.height=this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.shape.width+this.constants_.EMPTY_INLINE_INPUT_PADDING);this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;
Blockly.blockRendering.Types.isTopOrBottomRow=function(a){return a.type&(Blockly.blockRendering.Types.TOP_ROW|Blockly.blockRendering.Types.BOTTOM_ROW)};Blockly.blockRendering.Types.isInputRow=function(a){return a.type&Blockly.blockRendering.Types.INPUT_ROW};Blockly.blockRendering.Measurable=function(a){this.height=this.width=0;this.type=Blockly.blockRendering.Types.NONE;this.centerline=this.xPos=0;this.constants_=a;this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};Blockly.blockRendering.Connection=function(a,b){Blockly.blockRendering.Connection.superClass_.constructor.call(this,a);this.connectionModel=b;this.shape=this.constants_.shapeFor(b);this.type|=Blockly.blockRendering.Types.CONNECTION};Blockly.utils.object.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable);
Blockly.blockRendering.OutputConnection=function(a,b){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.OUTPUT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.startX=this.width};Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.OutputConnection.prototype.isDynamic=function(){return this.shape.isDynamic};
Blockly.blockRendering.PreviousConnection=function(a,b){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.PREVIOUS_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.NextConnection=function(a,b){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.NEXT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.InputConnection=function(a,b){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a,b.connection);this.type|=Blockly.blockRendering.Types.INPUT;this.input=b;this.align=b.align;if(this.connectedBlock=b.connection&&b.connection.targetBlock()?b.connection.targetBlock():null){var c=this.connectedBlock.getHeightWidth();this.connectedBlockWidth=c.width;this.connectedBlockHeight=c.height}else this.connectedBlockHeight=this.connectedBlockWidth=0;this.connection=
b.connection;this.connectionOffsetY=this.connectionOffsetX=0};Blockly.utils.object.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.InlineInput=function(a,b){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.INLINE_INPUT;this.connectedBlock?(this.width=this.connectedBlockWidth+this.constants_.DARK_PATH_OFFSET,this.height=this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.shape.width+this.constants_.EMPTY_INLINE_INPUT_PADDING);this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.InlineInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.StatementInput=function(a){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.STATEMENT_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=this.constants_.NOTCH_OFFSET_LEFT+this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.ExternalValueInput=function(a){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight-2*this.constants_.TAB_OFFSET_FROM_TOP:this.shape.height;this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=
this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection);Blockly.blockRendering.Icon=function(a){Blockly.blockRendering.Icon.superClass_.constructor.call(this);this.icon=a;this.isVisible=a.isVisible();this.type|=Blockly.blockRendering.Types.ICON;a=a.getCorrectedSize();this.height=a.height;this.width=a.width};Blockly.utils.object.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable);
Blockly.blockRendering.JaggedEdge=function(){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.JAGGED_EDGE;this.height=this.constants_.JAGGED_TEETH.height;this.width=this.constants_.JAGGED_TEETH.width};Blockly.utils.object.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Field=function(a,b){Blockly.blockRendering.Field.superClass_.constructor.call(this);this.field=a;this.isEditable=a.isCurrentlyEditable();this.flipRtl=a instanceof Blockly.FieldImage&&a.getFlipRtl();this.type|=Blockly.blockRendering.Types.FIELD;var c=this.field.getSize();this.height=c.height;this.width=c.width;this.parentInput=b};Blockly.utils.object.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Hat=function(){Blockly.blockRendering.Hat.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.ascenderHeight=this.height};Blockly.utils.object.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable);
Blockly.blockRendering.SquareCorner=function(a){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this);this.type=(a&&"left"!=a?Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER:Blockly.blockRendering.Types.LEFT_SQUARE_CORNER)|Blockly.blockRendering.Types.CORNER;this.width=this.height=this.constants_.NO_PADDING};Blockly.utils.object.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.RoundCorner=function(a){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this);this.type=(a&&"left"!=a?Blockly.blockRendering.Types.RIGHT_ROUND_CORNER:Blockly.blockRendering.Types.LEFT_ROUND_CORNER)|Blockly.blockRendering.Types.CORNER;this.width=this.constants_.CORNER_RADIUS;this.height=this.constants_.CORNER_RADIUS/2};Blockly.utils.object.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.InRowSpacer=function(a){Blockly.blockRendering.InRowSpacer.superClass_.constructor.call(this);this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.IN_ROW_SPACER;this.width=a;this.height=this.constants_.SPACER_DEFAULT_HEIGHT};Blockly.utils.object.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable);Blockly.blockRendering.Row=function(){this.type=Blockly.blockRendering.Types.ROW;this.elements=[];this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1;this.constants_=Blockly.blockRendering.getConstants();this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};
Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isInput(b))return b;return null};Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var a=0,b;b=this.elements[a];a++)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};
Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};Blockly.blockRendering.TopRow=function(){Blockly.blockRendering.TopRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.TOP_ROW;this.ascenderHeight=this.capline=0;this.hasPreviousConnection=!1;this.connection=null};Blockly.utils.object.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row);
Blockly.blockRendering.TopRow.prototype.populate=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=!!a.previousConnection;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);b?(b=new Blockly.blockRendering.Hat,this.elements.push(b),this.capline=b.ascenderHeight):c&&(this.hasPreviousConnection=!0,this.connection=new Blockly.blockRendering.PreviousConnection(a.previousConnection),this.elements.push(this.connection));
a.inputList.length&&a.inputList[0].type==Blockly.NEXT_STATEMENT&&!a.isCollapsed()?this.minHeight=this.constants_.LARGE_PADDING:this.minHeight=this.constants_.MEDIUM_PADDING};Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=a.getPreviousBlock();return!!a.outputConnection||b||c&&c.getNextBlock()==a};
Blockly.blockRendering.StatementInput=function(a,b){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.STATEMENT_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=this.constants_.NOTCH_OFFSET_LEFT+this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.ExternalValueInput=function(a,b){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight-2*this.constants_.TAB_OFFSET_FROM_TOP:this.shape.height;this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=
this.shape.width};Blockly.utils.object.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection);Blockly.blockRendering.Icon=function(a,b){Blockly.blockRendering.Icon.superClass_.constructor.call(this,a);this.icon=b;this.isVisible=b.isVisible();this.type|=Blockly.blockRendering.Types.ICON;var c=b.getCorrectedSize();this.height=c.height;this.width=c.width};Blockly.utils.object.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable);
Blockly.blockRendering.JaggedEdge=function(a){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.JAGGED_EDGE;this.height=this.constants_.JAGGED_TEETH.height;this.width=this.constants_.JAGGED_TEETH.width};Blockly.utils.object.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Field=function(a,b,c){Blockly.blockRendering.Field.superClass_.constructor.call(this,a);this.field=b;this.isEditable=b.isCurrentlyEditable();this.flipRtl=b instanceof Blockly.FieldImage&&b.getFlipRtl();this.type|=Blockly.blockRendering.Types.FIELD;a=this.field.getSize();this.height=a.height;this.width=a.width;this.parentInput=c};Blockly.utils.object.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Hat=function(a){Blockly.blockRendering.Hat.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.ascenderHeight=this.height};Blockly.utils.object.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable);
Blockly.blockRendering.SquareCorner=function(a,b){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this,a);this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER:Blockly.blockRendering.Types.LEFT_SQUARE_CORNER)|Blockly.blockRendering.Types.CORNER;this.width=this.height=this.constants_.NO_PADDING};Blockly.utils.object.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.RoundCorner=function(a,b){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this,a);this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_ROUND_CORNER:Blockly.blockRendering.Types.LEFT_ROUND_CORNER)|Blockly.blockRendering.Types.CORNER;this.width=this.constants_.CORNER_RADIUS;this.height=this.constants_.CORNER_RADIUS/2};Blockly.utils.object.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.InRowSpacer=function(a,b){Blockly.blockRendering.InRowSpacer.superClass_.constructor.call(this,a);this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.IN_ROW_SPACER;this.width=b;this.height=this.constants_.SPACER_DEFAULT_HEIGHT};Blockly.utils.object.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable);Blockly.blockRendering.Row=function(a){this.type=Blockly.blockRendering.Types.ROW;this.elements=[];this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1;this.constants_=a;this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};
Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isInput(b))return b;return null};Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var a=0,b;b=this.elements[a];a++)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};
Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};Blockly.blockRendering.TopRow=function(a){Blockly.blockRendering.TopRow.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.TOP_ROW;this.ascenderHeight=this.capline=0;this.hasPreviousConnection=!1;this.connection=null};Blockly.utils.object.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row);
Blockly.blockRendering.TopRow.prototype.populate=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=!!a.previousConnection;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_));b?(b=new Blockly.blockRendering.Hat(this.constants_),this.elements.push(b),this.capline=b.ascenderHeight):c&&(this.hasPreviousConnection=!0,this.connection=new Blockly.blockRendering.PreviousConnection(this.constants_,
a.previousConnection),this.elements.push(this.connection));a.inputList.length&&a.inputList[0].type==Blockly.NEXT_STATEMENT&&!a.isCollapsed()?this.minHeight=this.constants_.LARGE_PADDING:this.minHeight=this.constants_.MEDIUM_PADDING};Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=a.getPreviousBlock();return!!a.outputConnection||b||(c?c.getNextBlock()==a:!1)};
Blockly.blockRendering.TopRow.prototype.measure=function(){for(var a=0,b=0,c=0,d=0,e;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isHat(e)?c=Math.max(c,e.ascenderHeight):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b);this.height=Math.max(this.minHeight,a)+c;this.capline=this.ascenderHeight=c;this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.BottomRow=function(){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.BOTTOM_ROW;this.hasNextConnection=!1;this.connection=null;this.baseline=this.descenderHeight=0};Blockly.utils.object.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row);
Blockly.blockRendering.BottomRow.prototype.populate=function(a){this.hasNextConnection=!!a.nextConnection;this.minHeight=a.inputList.length&&a.inputList[a.inputList.length-1].type==Blockly.NEXT_STATEMENT?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING-1;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);this.hasNextConnection&&(this.connection=new Blockly.blockRendering.NextConnection(a.nextConnection),
this.elements.push(this.connection))};Blockly.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()};
Blockly.blockRendering.BottomRow=function(a){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.BOTTOM_ROW;this.hasNextConnection=!1;this.connection=null;this.baseline=this.descenderHeight=0};Blockly.utils.object.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row);
Blockly.blockRendering.BottomRow.prototype.populate=function(a){this.hasNextConnection=!!a.nextConnection;this.minHeight=a.inputList.length&&a.inputList[a.inputList.length-1].type==Blockly.NEXT_STATEMENT?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING-1;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_));this.hasNextConnection&&(this.connection=new Blockly.blockRendering.NextConnection(this.constants_,
a.nextConnection),this.elements.push(this.connection))};Blockly.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()};
Blockly.blockRendering.BottomRow.prototype.measure=function(){for(var a=0,b=0,c=0,d=0,e;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isNextConnection(e)?c=Math.max(c,e.height):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b);this.height=Math.max(this.minHeight,a)+c;this.descenderHeight=c;this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.SpacerRow=function(a,b){this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER;this.width=b;this.height=a;this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new Blockly.blockRendering.InRowSpacer(b)]};Blockly.utils.object.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row);Blockly.blockRendering.SpacerRow.prototype.measure=function(){};
Blockly.blockRendering.InputRow=function(){Blockly.blockRendering.InputRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.INPUT_ROW;this.connectedBlockWidths=0};Blockly.utils.object.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row);
Blockly.blockRendering.SpacerRow=function(a,b,c){Blockly.blockRendering.SpacerRow.superClass_.constructor.call(this,a);this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER;this.width=c;this.height=b;this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new Blockly.blockRendering.InRowSpacer(this.constants_,c)]};Blockly.utils.object.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row);
Blockly.blockRendering.SpacerRow.prototype.measure=function(){};Blockly.blockRendering.InputRow=function(a){Blockly.blockRendering.InputRow.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.INPUT_ROW;this.connectedBlockWidths=0};Blockly.utils.object.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row);
Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b=0,c;c=this.elements[b];b++)this.width+=c.width,Blockly.blockRendering.Types.isInput(c)&&(Blockly.blockRendering.Types.isStatementInput(c)?a+=c.connectedBlockWidth:Blockly.blockRendering.Types.isExternalInput(c)&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth)),Blockly.blockRendering.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height));this.connectedBlockWidths=
a;this.widthWithConnectedBlocks=this.width+a};Blockly.blockRendering.InputRow.prototype.getLastSpacer=function(){if(this.hasExternalInput||this.hasStatement)for(var a=this.elements,b=a.length-1,c;c=a[b];b--)if(!Blockly.blockRendering.Types.isSpacer(c)&&Blockly.blockRendering.Types.isInput(c))return a[b-1];return Blockly.blockRendering.InputRow.superClass_.getLastSpacer.call(this)};Blockly.blockRendering.RenderInfo=function(a){this.block_=a;this.outputConnection=a.outputConnection?new Blockly.blockRendering.OutputConnection(a.outputConnection):null;this.isInline=a.getInputsInline()&&!a.isCollapsed();this.isCollapsed=a.isCollapsed();this.isInsertionMarker=a.isInsertionMarker();this.RTL=a.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.hiddenIcons=[];this.topRow=new Blockly.blockRendering.TopRow;this.bottomRow=new Blockly.blockRendering.BottomRow;
this.startY=this.startX=0;this.constants_=Blockly.blockRendering.getConstants()};Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.computeBounds_();this.alignRowElements_();this.addRowSpacing_();this.finalize_()};
Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.topRow.populate(this.block_);this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow,b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=void 0;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow);
for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge));a.elements.length&&this.rows.push(a);this.bottomRow.populate(this.block_);this.rows.push(this.bottomRow)};
Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(a)),b.hasInlineInput=!0):a.type==Blockly.NEXT_STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(a)),b.hasStatement=!0):a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(a)),b.hasExternalInput=!0):a.type==Blockly.DUMMY_INPUT&&(b.hasDummyInput=!0)};
Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT||b.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var a=0,b;b=this.rows[a];a++){var c=b.elements;b.elements=[];Blockly.blockRendering.Types.isTopRow(b)||Blockly.blockRendering.Types.isBottomRow(b)||b.elements.push(new Blockly.blockRendering.InRowSpacer(this.getInRowSpacing_(null,c[0])));for(var d=0;d<c.length;d++){b.elements.push(c[d]);var e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new Blockly.blockRendering.InRowSpacer(e))}}};
a;this.widthWithConnectedBlocks=this.width+a};Blockly.blockRendering.InputRow.prototype.getLastSpacer=function(){if(this.hasExternalInput||this.hasStatement)for(var a=this.elements,b=a.length-1,c;c=a[b];b--)if(!Blockly.blockRendering.Types.isSpacer(c)&&Blockly.blockRendering.Types.isInput(c))return a[b-1];return Blockly.blockRendering.InputRow.superClass_.getLastSpacer.call(this)};Blockly.blockRendering.RenderInfo=function(a,b){this.block_=b;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new Blockly.blockRendering.OutputConnection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&!b.isCollapsed();this.isCollapsed=b.isCollapsed();this.isInsertionMarker=b.isInsertionMarker();this.RTL=b.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.hiddenIcons=[];this.topRow=
new Blockly.blockRendering.TopRow(this.constants_);this.bottomRow=new Blockly.blockRendering.BottomRow(this.constants_);this.startY=this.startX=0};Blockly.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_};Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.computeBounds_();this.alignRowElements_();this.addRowSpacing_();this.finalize_()};
Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.topRow.populate(this.block_);this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow(this.constants_),b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=null;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=
new Blockly.blockRendering.InputRow(this.constants_));for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(this.constants_,e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge(this.constants_)));a.elements.length&&this.rows.push(a);this.bottomRow.populate(this.block_);this.rows.push(this.bottomRow)};
Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==Blockly.NEXT_STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type==Blockly.DUMMY_INPUT&&(b.hasDummyInput=
!0)};Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT||b.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var a=0,b;b=this.rows[a];a++){var c=b.elements;b.elements=[];Blockly.blockRendering.Types.isTopRow(b)||Blockly.blockRendering.Types.isBottomRow(b)||b.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,c[0])));for(var d=0;d<c.length;d++){b.elements.push(c[d]);var e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,e))}}};
Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(a&&Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}return this.constants_.MEDIUM_PADDING};
Blockly.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0,e;e=this.rows[d];d++){e.measure();b=Math.max(b,e.width);if(e.hasStatement){var f=e.getLastInput();a=Math.max(a,e.width-f.width)}c=Math.max(c,e.widthWithConnectedBlocks)}this.statementEdge=a;this.width=b;for(d=0;e=this.rows[d];d++)e.hasStatement&&(e.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(b,c);this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,
this.widthWithChildren+=this.outputConnection.width)};Blockly.blockRendering.RenderInfo.prototype.alignRowElements_=function(){for(var a=0,b;b=this.rows[a];a++)if(b.hasStatement)this.alignStatementRow_(b);else{var c=this.width-this.startX-b.width;c&&this.addAlignmentPadding_(b,c)}};Blockly.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastSpacer();c&&(c.width+=b,a.width+=b)};
Blockly.blockRendering.RenderInfo.prototype.alignStatementRow_=function(a){var b=a.getLastInput(),c=a.width-b.width,d=this.statementEdge-this.startX;(c=d-c)&&this.addAlignmentPadding_(a,c);c=a.width;d=this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0);b.width+=d-c;a.width+=d-c;a.widthWithConnectedBlocks=Math.max(a.width,this.statementEdge+a.connectedBlockWidths)};
Blockly.blockRendering.RenderInfo.prototype.addRowSpacing_=function(){var a=this.rows;this.rows=[];for(var b=0;b<a.length;b++)this.rows.push(a[b]),b!=a.length-1&&this.rows.push(this.makeSpacerRow_(a[b],a[b+1]))};Blockly.blockRendering.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=new Blockly.blockRendering.SpacerRow(c,d);a.hasStatement&&(c.followsStatement=!0);return c};
Blockly.blockRendering.RenderInfo.prototype.addRowSpacing_=function(){var a=this.rows;this.rows=[];for(var b=0;b<a.length;b++)this.rows.push(a[b]),b!=a.length-1&&this.rows.push(this.makeSpacerRow_(a[b],a[b+1]))};Blockly.blockRendering.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=new Blockly.blockRendering.SpacerRow(this.constants_,c,d);a.hasStatement&&(c.followsStatement=!0);return c};
Blockly.blockRendering.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return this.width-this.startX};Blockly.blockRendering.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return this.constants_.MEDIUM_PADDING};Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;return c+=a.height/2};
Blockly.blockRendering.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);for(var e=d.xPos,f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.capline;this.bottomRow.baseline=b-this.bottomRow.descenderHeight};Blockly.blockRendering.Debug=function(){this.debugElements_=[];this.svgRoot_=null;this.config_=Blockly.blockRendering.Debug.getDebugConfig()};Blockly.blockRendering.Debug.getDebugConfig=function(){return{elems:!0,blockBounds:!0}};Blockly.blockRendering.Debug.prototype.clearElems=function(){for(var a=0,b;b=this.debugElements_[a];a++)Blockly.utils.dom.removeNode(b);this.debugElements_=[]};
Blockly.blockRendering.Debug.prototype.drawSpacerRow=function(a,b,c){this.config_.rowSpacers&&this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowSpacerRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height,stroke:"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))};
@@ -926,9 +924,9 @@ x:c?-(a.xPos+a.widthWithConnectedBlocks):a.xPos,y:a.yPos,width:a.widthWithConnec
Blockly.blockRendering.Debug.prototype.drawBoundingBox=function(a){if(this.config_.blockBounds){var b=a.RTL?-a.width:0;this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockBoundingBox blockRenderDebug",x:b,y:0,width:a.width,height:a.height,stroke:"black",fill:"none","stroke-width":"1px","stroke-dasharray":"5,5"},this.svgRoot_));this.config_.connectedBlockBounds&&(b=a.RTL?-a.widthWithChildren:0,this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockRenderDebug",
x:b,y:0,width:a.widthWithChildren,height:a.height,stroke:"#DF57BC",fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))}};
Blockly.blockRendering.Debug.prototype.drawDebug=function(a,b){this.clearElems();this.svgRoot_=a.getSvgRoot();this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);for(var c=0,d=0,e;e=b.rows[d];d++)Blockly.blockRendering.Types.isBetweenRowSpacer(e)?this.drawSpacerRow(e,c,b.RTL):this.drawRowWithElements(e,c,b.RTL),c+=e.height;a.previousConnection&&this.drawConnection(a.previousConnection);a.nextConnection&&this.drawConnection(a.nextConnection);a.outputConnection&&this.drawConnection(a.outputConnection);
this.drawBoundingBox(b)};Blockly.blockRendering.Drawer=function(a,b){this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.inlinePath_=this.outlinePath_="";this.constants_=Blockly.blockRendering.getConstants()};
Blockly.blockRendering.Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();var a=new Blockly.BlockSvg.PathObject;a.steps=[this.outlinePath_];a.inlineSteps=[this.inlinePath_];this.block_.setPaths_(a);Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height;this.block_.width=this.info_.widthWithChildren};
Blockly.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0,b;b=this.info_.hiddenIcons[a];a++)b.icon.iconGroup_.setAttribute("display","none")};Blockly.blockRendering.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var a=1;a<this.info_.rows.length-1;a++){var b=this.info_.rows[a];b.hasJaggedEdge?this.drawJaggedEdge_(b):b.hasStatement?this.drawStatementInput_(b):b.hasExternalInput?this.drawValueInput_(b):this.drawRightSideRow_(b)}this.drawBottom_();this.drawLeft_()};
this.drawBoundingBox(b)};Blockly.blockRendering.Drawer=function(a,b){this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.inlinePath_=this.outlinePath_="";this.constants_=b.getRenderer().getConstants()};Blockly.blockRendering.Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.block_.pathObject.setPaths(this.outlinePath_+"\n"+this.inlinePath_);Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};
Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height;this.block_.width=this.info_.widthWithChildren};Blockly.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0,b;b=this.info_.hiddenIcons[a];a++)b.icon.iconGroup_.setAttribute("display","none")};
Blockly.blockRendering.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var a=1;a<this.info_.rows.length-1;a++){var b=this.info_.rows[a];b.hasJaggedEdge?this.drawJaggedEdge_(b):b.hasStatement?this.drawStatementInput_(b):b.hasExternalInput?this.drawValueInput_(b):this.drawRightSideRow_(b)}this.drawBottom_();this.drawLeft_()};
Blockly.blockRendering.Drawer.prototype.drawTop_=function(){var a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c=0,d;d=b[c];c++)Blockly.blockRendering.Types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Blockly.blockRendering.Types.isPreviousConnection(d)?this.outlinePath_+=d.shape.pathLeft:Blockly.blockRendering.Types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:
Blockly.blockRendering.Types.isSpacer(d)&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",d.width));this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height)};Blockly.blockRendering.Drawer.prototype.drawJaggedEdge_=function(a){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.constants_.JAGGED_TEETH.height)};
Blockly.blockRendering.Drawer.prototype.drawValueInput_=function(a){var b=a.getLastInput();this.positionExternalValueConnection_(a);var c="function"==typeof b.shape.pathDown?b.shape.pathDown(b.height):b.shape.pathDown;this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",b.xPos+b.width)+c+Blockly.utils.svgPaths.lineOnAxis("v",a.height-b.connectionHeight)};
@@ -943,10 +941,11 @@ Blockly.blockRendering.Drawer.prototype.drawInlineInput_=function(a){var b=a.wid
Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connection){var c=a.xPos+a.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connection.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connection.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connection.setOffsetInBlock(c,a.yPos)}};Blockly.blockRendering.Drawer.prototype.positionPreviousConnection_=function(){var a=this.info_.topRow;if(a.connection){var b=a.xPos+a.notchOffset;a.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-b:b,0)}};
Blockly.blockRendering.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){a=a.connection;var b=a.xPos;a.connectionModel.setOffsetInBlock((this.info_.RTL?-b:b)+this.constants_.DARK_PATH_OFFSET/2,a.centerline-a.height/2+this.constants_.DARK_PATH_OFFSET)}};Blockly.blockRendering.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var a=this.info_.startX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,this.info_.outputConnection.connectionOffsetY)}};Blockly.blockRendering.Renderer=function(){this.constantProvider=Blockly.blockRendering.ConstantProvider;this.renderInfo=Blockly.blockRendering.RenderInfo;this.drawer=Blockly.blockRendering.Drawer;this["debugger"]=Blockly.blockRendering.Debug};Blockly.blockRendering.Renderer.prototype.init=function(){this.constants=new this.constantProvider;this.constants.init()};
Blockly.blockRendering.Renderer.prototype.render=function(a){a.renderingDebugger||(a.renderingDebugger=new this["debugger"]);var b=new this.renderInfo(a);b.measure();(new this.drawer(a,b)).draw()};Blockly.geras={};
Blockly.geras.Highlighter=function(a){this.info_=a;this.inlineSteps_=this.steps_="";this.RTL_=this.info_.RTL;this.constants_=Blockly.blockRendering.getConstants();this.highlightConstants_=Blockly.blockRendering.getRenderer().getHighlightConstants();this.highlightOffset_=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=
this.highlightConstants_.NOTCH;this.startPaths_=this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH};Blockly.geras.Highlighter.prototype.getSteps=function(){return this.steps_};Blockly.geras.Highlighter.prototype.getInlineSteps=function(){return this.inlineSteps_};
Blockly.blockRendering.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){a=a.connection;var b=a.xPos;a.connectionModel.setOffsetInBlock((this.info_.RTL?-b:b)+this.constants_.DARK_PATH_OFFSET/2,a.centerline-a.height/2+this.constants_.DARK_PATH_OFFSET)}};Blockly.blockRendering.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var a=this.info_.startX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,this.info_.outputConnection.connectionOffsetY)}};Blockly.blockRendering.Renderer=function(){this.constants_=null};Blockly.blockRendering.Renderer.prototype.init=function(){this.constants_=this.makeConstants_();this.constants_.init()};Blockly.blockRendering.Renderer.prototype.makeConstants_=function(){return new Blockly.blockRendering.ConstantProvider};Blockly.blockRendering.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.blockRendering.RenderInfo(this,a)};
Blockly.blockRendering.Renderer.prototype.makeDrawer_=function(a,b){return new Blockly.blockRendering.Drawer(a,b)};Blockly.blockRendering.Renderer.prototype.makeDebugger_=function(){return new Blockly.blockRendering.Debug};Blockly.blockRendering.Renderer.prototype.makePathObject=function(a){return new Blockly.blockRendering.PathObject(a)};Blockly.blockRendering.Renderer.prototype.getConstants=function(){return this.constants_};
Blockly.blockRendering.Renderer.prototype.render=function(a){a.renderingDebugger||(a.renderingDebugger=this.makeDebugger_());var b=this.makeRenderInfo_(a);b.measure();this.makeDrawer_(a,b).draw()};Blockly.geras={};
Blockly.geras.Highlighter=function(a){this.info_=a;this.inlineSteps_=this.steps_="";this.RTL_=this.info_.RTL;a=a.getRenderer();this.constants_=a.getConstants();this.highlightConstants_=a.getHighlightConstants();this.highlightOffset_=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=this.highlightConstants_.NOTCH;this.startPaths_=
this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH};Blockly.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_};
Blockly.geras.Highlighter.prototype.drawTopCorner=function(a){this.steps_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var b=0,c;c=a.elements[b];b++)Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Blockly.blockRendering.Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Blockly.blockRendering.Types.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Blockly.blockRendering.Types.isHat(c)?
this.steps_+=this.startPaths_.path(this.RTL_):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width-this.highlightOffset_)};
Blockly.geras.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.width-this.highlightOffset_),this.steps_+=this.jaggedTeethPaths_.pathLeft,this.steps_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))};
@@ -957,13 +956,14 @@ Blockly.geras.Highlighter.prototype.drawBottomRow=function(a){if(this.RTL_)this.
Blockly.geras.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX,a):(this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_));this.RTL_||(a=this.info_.topRow,Blockly.blockRendering.Types.isLeftRoundedCorner(a.elements[0])?
this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",this.outsideCornerPaths_.height):this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.capline+this.highlightOffset_))};
Blockly.geras.Highlighter.prototype.drawInlineInput=function(a){var b=this.highlightOffset_,c=a.xPos+a.connectionWidth,d=a.centerline-a.height/2,e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,this.inlineSteps_+=Blockly.utils.svgPaths.moveTo(c-b,f)+Blockly.utils.svgPaths.lineOnAxis("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",a)+Blockly.utils.svgPaths.lineOnAxis("h",e)):this.inlineSteps_+=
Blockly.utils.svgPaths.moveTo(a.xPos+a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)};Blockly.geras.RenderInfo=function(a){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo);
Blockly.utils.svgPaths.moveTo(a.xPos+a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)};Blockly.geras.PathObject=function(a){this.svgRoot=a;this.svgPathDark=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot);this.svgPath=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath"},this.svgRoot);this.svgPathLight=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgRoot)};
Blockly.geras.PathObject.prototype.setPaths=function(a,b){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a);this.svgPathLight.setAttribute("d",b);this.RTL&&(this.svgPath.setAttribute("transform","scale(-1 1)"),this.svgPathLight.setAttribute("transform","scale(-1 1)"),this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)"))};Blockly.geras.RenderInfo=function(a,b){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.geras.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
Blockly.geras.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:
Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&b&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&b&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset;if(Blockly.blockRendering.Types.isNextConnection(b)){var c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b){if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS;if(Blockly.blockRendering.Types.isNextConnection(b))return c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,b.notchOffset-
this.constants_.CORNER_RADIUS+c}return!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
this.constants_.CORNER_RADIUS+c}return!Blockly.blockRendering.Types.isInput(a)&&b&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.geras.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getFirstSpacer(),e=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)e=c[c.length-3],a.widthWithConnectedBlocks+=b;(c=a.getLastInput())?c.align==Blockly.ALIGN_LEFT?e.width+=b:c.align==Blockly.ALIGN_CENTRE?(d.width+=b/2,e.width+=b/2):c.align==Blockly.ALIGN_RIGHT&&(d.width+=b):e.width+=b;a.width+=b};
Blockly.geras.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)||Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||!a.hasStatement&&
b.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
@@ -971,10 +971,10 @@ Blockly.geras.RenderInfo.prototype.getElemCenterline_=function(a,b){if(Blockly.b
this.constants_.TALL_INPUT_FIELD_OFFSET_Y}else c=Blockly.blockRendering.Types.isInlineInput(b)?c+b.height/2:c+a.height/2;return c};
Blockly.geras.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);var e=b-this.topRow.ascenderHeight;d==this.bottomRow&&e<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=
a+this.startX+this.constants_.DARK_PATH_OFFSET;this.width+=this.constants_.DARK_PATH_OFFSET;this.height=b+this.constants_.DARK_PATH_OFFSET;this.startY=this.topRow.capline};Blockly.geras.Drawer=function(a,b){Blockly.geras.Drawer.superClass_.constructor.call(this,a,b);this.highlighter_=new Blockly.geras.Highlighter(b)};Blockly.utils.object.inherits(Blockly.geras.Drawer,Blockly.blockRendering.Drawer);
Blockly.geras.Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();var a=new Blockly.BlockSvg.PathObject;a.steps=[this.outlinePath_];a.inlineSteps=[this.inlinePath_];a.highlightSteps=[this.highlighter_.getSteps()];a.highlightInlineSteps=[this.highlighter_.getInlineSteps()];this.block_.setPaths_(a);Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};
Blockly.geras.Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);Blockly.geras.Drawer.superClass_.drawTop_.call(this)};Blockly.geras.Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_.drawJaggedEdge_(a);Blockly.geras.Drawer.superClass_.drawJaggedEdge_.call(this,a)};
Blockly.geras.Drawer.prototype.drawValueInput_=function(a){this.highlighter_.drawValueInput(a);Blockly.geras.Drawer.superClass_.drawValueInput_.call(this,a)};Blockly.geras.Drawer.prototype.drawStatementInput_=function(a){this.highlighter_.drawStatementInput(a);Blockly.geras.Drawer.superClass_.drawStatementInput_.call(this,a)};Blockly.geras.Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_.drawRightSideRow(a);Blockly.geras.Drawer.superClass_.drawRightSideRow_.call(this,a)};
Blockly.geras.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);Blockly.geras.Drawer.superClass_.drawBottom_.call(this)};Blockly.geras.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();Blockly.geras.Drawer.superClass_.drawLeft_.call(this)};Blockly.geras.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);Blockly.geras.Drawer.superClass_.drawInlineInput_.call(this,a)};Blockly.geras.HighlightConstantProvider=function(){this.constantProvider=Blockly.blockRendering.getConstants();this.OFFSET=.5;this.START_POINT=Blockly.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET);this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()};
Blockly.geras.Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.block_.pathObject.setPaths(this.outlinePath_+"\n"+this.inlinePath_,this.highlighter_.getPath());Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};Blockly.geras.Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);Blockly.geras.Drawer.superClass_.drawTop_.call(this)};
Blockly.geras.Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_.drawJaggedEdge_(a);Blockly.geras.Drawer.superClass_.drawJaggedEdge_.call(this,a)};Blockly.geras.Drawer.prototype.drawValueInput_=function(a){this.highlighter_.drawValueInput(a);Blockly.geras.Drawer.superClass_.drawValueInput_.call(this,a)};Blockly.geras.Drawer.prototype.drawStatementInput_=function(a){this.highlighter_.drawStatementInput(a);Blockly.geras.Drawer.superClass_.drawStatementInput_.call(this,a)};
Blockly.geras.Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_.drawRightSideRow(a);Blockly.geras.Drawer.superClass_.drawRightSideRow_.call(this,a)};Blockly.geras.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);Blockly.geras.Drawer.superClass_.drawBottom_.call(this)};Blockly.geras.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();Blockly.geras.Drawer.superClass_.drawLeft_.call(this)};
Blockly.geras.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);Blockly.geras.Drawer.superClass_.drawInlineInput_.call(this,a)};Blockly.geras.HighlightConstantProvider=function(a){this.constantProvider=a;this.OFFSET=.5;this.START_POINT=Blockly.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET);this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()};
Blockly.geras.HighlightConstantProvider.prototype.makeInsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a+b)-b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-c-b,a-c)),e=Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a+b,a+b)),f=Blockly.utils.svgPaths.moveBy(c,-c)+Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a-c,c+b));return{width:a+b,height:a,
pathTop:function(a){return a?d:""},pathBottom:function(a){return a?e:f}}};
Blockly.geras.HighlightConstantProvider.prototype.makeOutsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a-b)+b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a-c,-c+b)),e=Blockly.utils.svgPaths.moveBy(b,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a,-a+b)),f=-c,g=Blockly.utils.svgPaths.moveBy(c,f)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(-c+
@@ -983,8 +983,8 @@ Blockly.geras.HighlightConstantProvider.prototype.makePuzzleTab=function(){var a
2.5),e=Blockly.utils.svgPaths.lineOnAxis("v",-1.5)+Blockly.utils.svgPaths.moveBy(-.92*a,-.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(-.19*a,-5.5),Blockly.utils.svgPaths.point(0,-11)])+Blockly.utils.svgPaths.moveBy(.92*a,1),f=Blockly.utils.svgPaths.moveBy(-5,b-.7)+Blockly.utils.svgPaths.lineTo(.46*a,-2.1);return{width:a,height:b,pathUp:function(a){return a?c:e},pathDown:function(a){return a?d:f}}};
Blockly.geras.HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:Blockly.utils.svgPaths.lineOnAxis("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}};Blockly.geras.HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:Blockly.utils.svgPaths.lineTo(5.1,2.6)+Blockly.utils.svgPaths.moveBy(-10.2,6.8)+Blockly.utils.svgPaths.lineTo(5.1,2.6)}};
Blockly.geras.HighlightConstantProvider.prototype.makeStartHat=function(){var a=this.constantProvider.START_HAT.height,b=Blockly.utils.svgPaths.moveBy(25,-8.7)+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(29.7,-6.2),Blockly.utils.svgPaths.point(57.2,-.5),Blockly.utils.svgPaths.point(75,8.7)]),c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(17.8,-9.2),Blockly.utils.svgPaths.point(45.3,-14.9),Blockly.utils.svgPaths.point(75,-8.7)])+Blockly.utils.svgPaths.moveTo(100.5,
a+.5);return{path:function(a){return a?b:c}}};Blockly.geras.Renderer=function(){this.constantProvider=Blockly.blockRendering.ConstantProvider;this.renderInfo=Blockly.geras.RenderInfo;this.drawer=Blockly.geras.Drawer;this["debugger"]=Blockly.blockRendering.Debug};Blockly.utils.object.inherits(Blockly.geras.Renderer,Blockly.blockRendering.Renderer);Blockly.geras.Renderer.prototype.init=function(){Blockly.geras.Renderer.superClass_.init.call(this);this.highlightConstants=new Blockly.geras.HighlightConstantProvider};
Blockly.geras.Renderer.prototype.getHighlightConstants=function(){return Blockly.blockRendering.renderer.highlightConstants};Blockly.blockRendering.register("geras",Blockly.geras.Renderer);Blockly.Action=function(a,b){this.name=a;this.desc=b};Blockly.ASTNode=function(a,b,c){if(!b)throw Error("Cannot create a node without a location.");this.type_=a;this.isConnection_=Blockly.ASTNode.isConnectionType(a);this.location_=b;this.processParams_(c||null)};Blockly.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"};Blockly.ASTNode.wsMove_=10;Blockly.ASTNode.DEFAULT_OFFSET_Y=-20;Blockly.ASTNode.isConnectionType=function(a){switch(a){case Blockly.ASTNode.types.PREVIOUS:case Blockly.ASTNode.types.NEXT:case Blockly.ASTNode.types.INPUT:case Blockly.ASTNode.types.OUTPUT:return!0}return!1};
a+.5);return{path:function(a){return a?b:c}}};Blockly.geras.Renderer=function(){Blockly.geras.Renderer.superClass_.constructor.call(this);this.highlightConstants_=null};Blockly.utils.object.inherits(Blockly.geras.Renderer,Blockly.blockRendering.Renderer);Blockly.geras.Renderer.prototype.init=function(){Blockly.geras.Renderer.superClass_.init.call(this);this.highlightConstants_=this.makeHighlightConstants_()};Blockly.geras.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.geras.RenderInfo(this,a)};
Blockly.geras.Renderer.prototype.makeDrawer_=function(a,b){return new Blockly.geras.Drawer(a,b)};Blockly.geras.Renderer.prototype.makePathObject=function(a){return new Blockly.geras.PathObject(a)};Blockly.blockRendering.Renderer.prototype.makeHighlightConstants_=function(){return new Blockly.geras.HighlightConstantProvider(this.getConstants())};Blockly.geras.Renderer.prototype.getHighlightConstants=function(){return this.highlightConstants_};Blockly.blockRendering.register("geras",Blockly.geras.Renderer);Blockly.Action=function(a,b){this.name=a;this.desc=b};Blockly.ASTNode=function(a,b,c){if(!b)throw Error("Cannot create a node without a location.");this.type_=a;this.isConnection_=Blockly.ASTNode.isConnectionType(a);this.location_=b;this.processParams_(c||null)};Blockly.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"};Blockly.ASTNode.wsMove_=10;Blockly.ASTNode.DEFAULT_OFFSET_Y=-20;Blockly.ASTNode.isConnectionType=function(a){switch(a){case Blockly.ASTNode.types.PREVIOUS:case Blockly.ASTNode.types.NEXT:case Blockly.ASTNode.types.INPUT:case Blockly.ASTNode.types.OUTPUT:return!0}return!1};
Blockly.ASTNode.createFieldNode=function(a){return new Blockly.ASTNode(Blockly.ASTNode.types.FIELD,a)};
Blockly.ASTNode.createConnectionNode=function(a){return a?a.type===Blockly.INPUT_VALUE||a.type===Blockly.NEXT_STATEMENT&&a.getParentInput()?Blockly.ASTNode.createInputNode(a.getParentInput()):a.type===Blockly.NEXT_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.NEXT,a):a.type===Blockly.OUTPUT_VALUE?new Blockly.ASTNode(Blockly.ASTNode.types.OUTPUT,a):a.type===Blockly.PREVIOUS_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.PREVIOUS,a):null:null};
Blockly.ASTNode.createInputNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.INPUT,a.connection,{input:a}):null};Blockly.ASTNode.createBlockNode=function(a){return new Blockly.ASTNode(Blockly.ASTNode.types.BLOCK,a)};Blockly.ASTNode.createStackNode=function(a){return new Blockly.ASTNode(Blockly.ASTNode.types.STACK,a)};Blockly.ASTNode.createWorkspaceNode=function(a,b){return new Blockly.ASTNode(Blockly.ASTNode.types.WORKSPACE,a,{wsCoordinate:b})};
@@ -1059,26 +1059,26 @@ d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap",16);var e=B
d.appendChild(e),c.push(d));Blockly.Blocks.procedures_ifreturn&&(d=Blockly.utils.xml.createElement("block"),d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=Blockly.Procedures.allProcedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};
Blockly.Procedures.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(!1),e=0;e<d.length;e++)if(d[e].getProcedureCall){var f=d[e].getProcedureCall();f&&Blockly.Names.equals(f,a)&&c.push(d[e])}return c};
Blockly.Procedures.mutateCallers=function(a){var b=Blockly.Events.recordUndo,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Blockly.Procedures.getCallers(c,a.workspace);c=0;for(var e;e=a[c];c++){var f=e.mutationToDom();f=f&&Blockly.Xml.domToText(f);e.domToMutation(d);var g=e.mutationToDom();g=g&&Blockly.Xml.domToText(g);f!=g&&(Blockly.Events.recordUndo=!1,Blockly.Events.fire(new Blockly.Events.BlockChange(e,"mutation",null,f,g)),Blockly.Events.recordUndo=b)}};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getTopBlocks(!1),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getTopBlocks(!1),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a,b){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.thrasos.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:
Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))return b.notchOffset}return Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b?b.notchOffset-this.constants_.CORNER_RADIUS:!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&b&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&b&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))return b.notchOffset}return Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b?b.notchOffset-this.constants_.CORNER_RADIUS:!Blockly.blockRendering.Types.isInput(a)&&b&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.thrasos.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getFirstSpacer(),e=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)e=c[c.length-3],a.widthWithConnectedBlocks+=b;(c=a.getLastInput())?c.align==Blockly.ALIGN_LEFT?e.width+=b:c.align==Blockly.ALIGN_CENTRE?(d.width+=b/2,e.width+=b/2):c.align==Blockly.ALIGN_RIGHT&&(d.width+=b):e.width+=b;a.width+=b};
Blockly.thrasos.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)||Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||b.hasDummyInput?
this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.thrasos.RenderInfo.prototype.getElemCenterline_=function(a,b){if(Blockly.blockRendering.Types.isBottomRow(a)){var c=a.yPos+a.height-a.descenderHeight;return Blockly.blockRendering.Types.isNextConnection(b)?c+b.height/2:c-b.height/2}if(Blockly.blockRendering.Types.isTopRow(a))return Blockly.blockRendering.Types.isHat(b)?a.capline-b.height/2:a.capline+b.height/2;c=a.yPos;return c=Blockly.blockRendering.Types.isField(b)&&a.hasStatement?c+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):
c+a.height/2};
Blockly.thrasos.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);var e=b-this.topRow.ascenderHeight;d==this.bottomRow&&e<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=
a+this.startX;this.height=b;this.startY=this.topRow.capline};Blockly.thrasos.Renderer=function(){this.constantProvider=Blockly.blockRendering.ConstantProvider;this.renderInfo=Blockly.thrasos.RenderInfo;this.drawer=Blockly.blockRendering.Drawer;this["debugger"]=Blockly.blockRendering.Debug};Blockly.utils.object.inherits(Blockly.thrasos.Renderer,Blockly.blockRendering.Renderer);Blockly.blockRendering.register("thrasos",Blockly.thrasos.Renderer);Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.getAttribute("callbackKey")||c.getAttribute("callbackkey");this.cssClass_=c.getAttribute("web-class")||null};Blockly.FlyoutButton.MARGIN=5;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=0;Blockly.FlyoutButton.prototype.onMouseUpWrapper_=null;
a+this.startX;this.height=b;this.startY=this.topRow.capline};Blockly.thrasos.Renderer=function(){Blockly.thrasos.Renderer.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.thrasos.Renderer,Blockly.blockRendering.Renderer);Blockly.thrasos.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.thrasos.RenderInfo(this,a)};Blockly.blockRendering.register("thrasos",Blockly.thrasos.Renderer);Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.getAttribute("callbackKey")||c.getAttribute("callbackkey");this.cssClass_=c.getAttribute("web-class")||null};Blockly.FlyoutButton.MARGIN=5;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=0;Blockly.FlyoutButton.prototype.onMouseUpWrapper_=null;
Blockly.FlyoutButton.prototype.createDom=function(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&(a+=" "+this.cssClass_);this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},this.workspace_.getCanvas());if(!this.isLabel_)var b=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);a=Blockly.utils.dom.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",
rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);c.textContent=Blockly.utils.replaceMessageReferences(this.text_);this.width=Blockly.utils.dom.getTextWidth(c);this.height=20;this.isLabel_||(this.width+=2*Blockly.FlyoutButton.MARGIN,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);
c.setAttribute("x",this.width/2);c.setAttribute("y",this.height-Blockly.FlyoutButton.MARGIN);this.updateTransform_();this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.onMouseUp_);return this.svgGroup_};Blockly.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};
Blockly.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")};Blockly.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_};Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};
Blockly.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&Blockly.unbindEvent_(this.onMouseUpWrapper_);this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=this.workspace_=null};
Blockly.FlyoutButton.prototype.onMouseUp_=function(a){(a=this.targetWorkspace_.getGesture(a))&&a.cancel();this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)};Blockly.FlyoutCursor=function(){Blockly.FlyoutCursor.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.FlyoutCursor,Blockly.Cursor);Blockly.FlyoutCursor.prototype.next=function(){if(!this.isMarker_){var a=this.getCurNode();if(!a)return null;(a=a.next())&&this.setLocation(a);return a}};Blockly.FlyoutCursor.prototype["in"]=function(){return null};
Blockly.FlyoutCursor.prototype.prev=function(){if(!this.isMarker_){var a=this.getCurNode();if(!a)return null;(a=a.prev())&&this.setLocation(a);return a}};Blockly.FlyoutCursor.prototype.out=function(){return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.workspace_.setCursor(new Blockly.FlyoutCursor);this.workspace_.setMarker(new Blockly.MarkerCursor);this.RTL=!!a.RTL;this.toolboxPosition_=a.toolboxPosition;this.eventWrappers_=[];this.mats_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[];this.tabWidth_=Blockly.blockRendering.getConstants().TAB_WIDTH};
Blockly.FlyoutCursor.prototype.prev=function(){if(!this.isMarker_){var a=this.getCurNode();if(!a)return null;(a=a.prev())&&this.setLocation(a);return a}};Blockly.FlyoutCursor.prototype.out=function(){return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.workspace_.setCursor(new Blockly.FlyoutCursor);this.workspace_.setMarker(new Blockly.MarkerCursor);this.RTL=!!a.RTL;this.toolboxPosition_=a.toolboxPosition;this.eventWrappers_=[];this.mats_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[];this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH};
Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.isVisible_=!1;Blockly.Flyout.prototype.containerVisible_=!0;Blockly.Flyout.prototype.CORNER_RADIUS=8;Blockly.Flyout.prototype.MARGIN=Blockly.Flyout.prototype.CORNER_RADIUS;Blockly.Flyout.prototype.GAP_X=3*Blockly.Flyout.prototype.MARGIN;Blockly.Flyout.prototype.GAP_Y=3*Blockly.Flyout.prototype.MARGIN;Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;
Blockly.Flyout.prototype.dragAngleRange_=70;Blockly.Flyout.prototype.createDom=function(a){this.svgGroup_=Blockly.utils.dom.createSvgElement(a,{"class":"blocklyFlyout",style:"display: none"},null);this.svgBackground_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
Blockly.Flyout.prototype.init=function(a){this.targetWorkspace_=a;this.workspace_.targetWorkspace=a;this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1,"blocklyFlyoutScrollbar");this.hide();Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEventWithChecks_(this.svgGroup_,"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace_.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,
@@ -1246,18 +1246,19 @@ Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck()
Blockly.zelos.ConstantProvider.prototype.makeNotch=function(){function a(a){return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,g/2),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,g/2),Blockly.utils.svgPaths.point(a*e/2,g),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.lineOnAxis("h",a*d)+Blockly.utils.svgPaths.curve("c",
[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,-(g/2)),Blockly.utils.svgPaths.point(a*e,-g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,-f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,-(g/2)),Blockly.utils.svgPaths.point(a*e/2,-g),Blockly.utils.svgPaths.point(a*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{width:b,height:c,pathLeft:h,pathRight:k}};
Blockly.zelos.ConstantProvider.prototype.makeOutsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.moveBy(0,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,-a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,-a));a=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a));return{topLeft:b,topRight:c,bottomRight:a,bottomLeft:d}};
Blockly.zelos.ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a)),e=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pathTopRight:c,pathBottomRight:e}};Blockly.zelos.TopRow=function(){Blockly.zelos.TopRow.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow);Blockly.zelos.TopRow.prototype.populate=function(a){Blockly.zelos.TopRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner("right")):this.elements.push(new Blockly.blockRendering.RoundCorner("right"))};Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};
Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BottomRow=function(){Blockly.zelos.BottomRow.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow);Blockly.zelos.BottomRow.prototype.populate=function(a){Blockly.zelos.BottomRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner("right")):this.elements.push(new Blockly.blockRendering.RoundCorner("right"))};
Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BeforeStatementSpacerRow=function(a,b){Blockly.zelos.BeforeStatementSpacerRow.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.getType("BEFORE_STATEMENT_SPACER_ROW")};Blockly.utils.object.inherits(Blockly.zelos.BeforeStatementSpacerRow,Blockly.blockRendering.SpacerRow);
Blockly.zelos.AfterStatementSpacerRow=function(a,b){Blockly.zelos.AfterStatementSpacerRow.superClass_.constructor.call(this,a,b);this.type|=Blockly.blockRendering.Types.getType("AFTER_STATEMENT_SPACER_ROW")};Blockly.utils.object.inherits(Blockly.zelos.AfterStatementSpacerRow,Blockly.blockRendering.SpacerRow);Blockly.zelos.RenderInfo=function(a){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a);this.topRow=new Blockly.zelos.TopRow;this.bottomRow=new Blockly.zelos.BottomRow};Blockly.utils.object.inherits(Blockly.zelos.RenderInfo,Blockly.blockRendering.RenderInfo);
Blockly.zelos.ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a)),e=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pathTopRight:c,pathBottomRight:e}};Blockly.zelos.TopRow=function(a){Blockly.zelos.TopRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow);Blockly.zelos.TopRow.prototype.populate=function(a){Blockly.zelos.TopRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))};
Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BottomRow=function(a){Blockly.zelos.BottomRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow);
Blockly.zelos.BottomRow.prototype.populate=function(a){Blockly.zelos.BottomRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))};Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection};
Blockly.zelos.BeforeStatementSpacerRow=function(a,b,c){Blockly.zelos.BeforeStatementSpacerRow.superClass_.constructor.call(this,a,b,c);this.type|=Blockly.blockRendering.Types.getType("BEFORE_STATEMENT_SPACER_ROW")};Blockly.utils.object.inherits(Blockly.zelos.BeforeStatementSpacerRow,Blockly.blockRendering.SpacerRow);Blockly.zelos.AfterStatementSpacerRow=function(a,b,c){Blockly.zelos.AfterStatementSpacerRow.superClass_.constructor.call(this,a,b,c);this.type|=Blockly.blockRendering.Types.getType("AFTER_STATEMENT_SPACER_ROW")};
Blockly.utils.object.inherits(Blockly.zelos.AfterStatementSpacerRow,Blockly.blockRendering.SpacerRow);Blockly.zelos.RenderInfo=function(a,b){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a,b);this.topRow=new Blockly.zelos.TopRow(this.constants_);this.bottomRow=new Blockly.zelos.BottomRow(this.constants_)};Blockly.utils.object.inherits(Blockly.zelos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.zelos.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
Blockly.zelos.RenderInfo.prototype.getInRowSpacing_=function(a,b){if((!a||!b)&&this.outputConnection&&this.outputConnection.isDynamic())return this.constants_.NO_PADDING;if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&
!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isRightRoundedCorner(a)||Blockly.blockRendering.Types.isJaggedEdge(a)?
this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||
Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&
!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))return b.notchOffset}return Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b&&(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))?
b.notchOffset-this.constants_.CORNER_RADIUS:!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.zelos.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=Blockly.blockRendering.Types.isInputRow(b)&&b.hasStatement?new Blockly.zelos.BeforeStatementSpacerRow(Math.max(c,this.constants_.INSIDE_CORNERS.rightHeight||0),d):Blockly.blockRendering.Types.isInputRow(a)&&a.hasStatement?new Blockly.zelos.AfterStatementSpacerRow(Math.max(c,this.constants_.INSIDE_CORNERS.rightHeight||0),d):new Blockly.blockRendering.SpacerRow(c,d);a.hasStatement&&
(c.followsStatement=!0);return c};Blockly.zelos.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)&&!a.hasPreviousConnection||Blockly.blockRendering.Types.isBottomRow(b)&&!b.hasNextConnection?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&b&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&
b&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))return b.notchOffset}return Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b&&(Blockly.blockRendering.Types.isPreviousConnection(b)||
Blockly.blockRendering.Types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:!Blockly.blockRendering.Types.isInput(a)&&b&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.zelos.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=Blockly.blockRendering.Types.isInputRow(b)&&b.hasStatement?new Blockly.zelos.BeforeStatementSpacerRow(this.constants_,Math.max(c,this.constants_.INSIDE_CORNERS.rightHeight||0),d):Blockly.blockRendering.Types.isInputRow(a)&&a.hasStatement?new Blockly.zelos.AfterStatementSpacerRow(this.constants_,Math.max(c,this.constants_.INSIDE_CORNERS.rightHeight||0),d):new Blockly.blockRendering.SpacerRow(this.constants_,
c,d);a.hasStatement&&(c.followsStatement=!0);return c};Blockly.zelos.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)&&!a.hasPreviousConnection||Blockly.blockRendering.Types.isBottomRow(b)&&!b.hasNextConnection?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.zelos.RenderInfo.prototype.getElemCenterline_=function(a,b){if(Blockly.blockRendering.Types.isBottomRow(a)){var c=a.yPos+a.height-a.descenderHeight;return Blockly.blockRendering.Types.isNextConnection(b)?c+b.height/2:c-b.height/2}return Blockly.blockRendering.Types.isTopRow(a)?Blockly.blockRendering.Types.isHat(b)?a.capline-b.height/2:a.capline+b.height/2:a.yPos+a.height/2};
Blockly.zelos.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastSpacer();Blockly.blockRendering.Types.isTopOrBottomRow(a)&&(c=a.elements[a.elements.length-3]);c&&(c.width+=b,a.width+=b)};
Blockly.zelos.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c;c=this.rows[b];b++)c.yPos=a,a+=c.height;b=0;this.outputConnection&&!this.outputConnection.height&&(b=this.outputConnection.height=a,this.outputConnection.width=b/2);this.startX+=b/2;this.width+=b;var d=0;for(b=0;c=this.rows[b];b++){c.xPos=this.startX;d=Math.max(d,c.widthWithConnectedBlocks);for(var e=c.xPos,f=0,g;g=c.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(c,g),e+=g.width}this.widthWithChildren=d+this.startX;
@@ -1269,7 +1270,8 @@ c=this.constants_.INSIDE_CORNERS.rightHeight):Blockly.blockRendering.Types.isSpa
Blockly.zelos.Drawer.prototype.drawRightSideRow_=function(a){if(a.type&Blockly.blockRendering.Types.getType("BEFORE_STATEMENT_SPACER_ROW")){var b=a.height-this.constants_.INSIDE_CORNERS.rightWidth;this.outlinePath_+=(0<b?Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+b):"")+this.constants_.INSIDE_CORNERS.pathTopRight}else a.type&Blockly.blockRendering.Types.getType("AFTER_STATEMENT_SPACER_ROW")?(b=a.height-this.constants_.INSIDE_CORNERS.rightWidth,this.outlinePath_+=this.constants_.INSIDE_CORNERS.pathBottomRight+
(0<b?Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height):"")):this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height)};Blockly.zelos.Drawer.prototype.drawRightDynamicConnection_=function(){this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)};
Blockly.zelos.Drawer.prototype.drawLeftDynamicConnection_=function(){this.positionOutputConnection_();this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height);this.outlinePath_+="z"};Blockly.zelos.Drawer.prototype.drawFlatTop_=function(){var a=this.info_.topRow;this.positionPreviousConnection_();this.outlinePath_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",a.width)};
Blockly.zelos.Drawer.prototype.drawFlatBottom_=function(){var a=this.info_.bottomRow;this.positionNextConnection_();this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.baseline);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",-a.width)};Blockly.zelos.Drawer.prototype.drawInlineInput_=function(a){this.positionInlineInputConnection_(a)};Blockly.zelos.Renderer=function(){this.constantProvider=Blockly.zelos.ConstantProvider;this.renderInfo=Blockly.zelos.RenderInfo;this.drawer=Blockly.zelos.Drawer;this["debugger"]=Blockly.blockRendering.Debug};Blockly.utils.object.inherits(Blockly.zelos.Renderer,Blockly.blockRendering.Renderer);Blockly.blockRendering.register("zelos",Blockly.zelos.Renderer);Blockly.VERSION="2.20190722.0-develop";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.cursor=null;Blockly.keyboardAccessibilityMode=!1;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.theme_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
Blockly.zelos.Drawer.prototype.drawFlatBottom_=function(){var a=this.info_.bottomRow;this.positionNextConnection_();this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.baseline);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",-a.width)};Blockly.zelos.Drawer.prototype.drawInlineInput_=function(a){this.positionInlineInputConnection_(a)};Blockly.zelos.Renderer=function(){Blockly.zelos.Renderer.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.zelos.Renderer,Blockly.blockRendering.Renderer);Blockly.zelos.Renderer.prototype.makeConstants_=function(){return new Blockly.zelos.ConstantProvider};Blockly.zelos.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.zelos.RenderInfo(this,a)};Blockly.zelos.Renderer.prototype.makeDrawer_=function(a,b){return new Blockly.zelos.Drawer(a,b)};
Blockly.blockRendering.register("zelos",Blockly.zelos.Renderer);Blockly.VERSION="2.20190722.0-develop";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.cursor=null;Blockly.keyboardAccessibilityMode=!1;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.theme_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
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()}};
Blockly.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))if(b.options.readOnly)Blockly.navigation.onKeyPress(a);else{var c=!1;if(a.keyCode==Blockly.utils.KeyCodes.ESC)Blockly.hideChaff(),Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_EXIT);else{if(Blockly.navigation.onKeyPress(a))return;if(a.keyCode==Blockly.utils.KeyCodes.BACKSPACE||a.keyCode==Blockly.utils.KeyCodes.DELETE){a.preventDefault();if(Blockly.Gesture.inProgress())return;
Blockly.selected&&Blockly.selected.isDeletable()&&(c=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(a.keyCode==Blockly.utils.KeyCodes.C?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):a.keyCode!=Blockly.utils.KeyCodes.X||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),c=!0));a.keyCode==Blockly.utils.KeyCodes.V?Blockly.clipboardXml_&&(a=Blockly.clipboardSource_,

View File

@@ -33,7 +33,7 @@ goog.addDependency("../../../" + dir + "/core/block_drag_surface.js", ['Blockly.
goog.addDependency("../../../" + dir + "/core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.blockAnimations', 'Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.InsertionMarkerManager', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
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', 'Blockly.utils.Coordinate', 'Blockly.utils.object', 'Blockly.utils.xml']);
goog.addDependency("../../../" + dir + "/core/block_render_svg.js", ['Blockly.BlockSvg.render'], ['Blockly.blockRendering', 'Blockly.BlockSvg', 'Blockly.utils.dom']);
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.blockAnimations', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.Msg', 'Blockly.RenderedConnection', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect']);
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.blockAnimations', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.Msg', 'Blockly.RenderedConnection', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect', 'Blockly.blockRendering.PathObject']);
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.geras.Renderer', 'Blockly.navigation', 'Blockly.Procedures', 'Blockly.thrasos.Renderer', 'Blockly.Toolbox', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'Blockly.Xml', 'Blockly.zelos.Renderer']);
goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []);
goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.math', 'Blockly.utils.userAgent', 'Blockly.Workspace']);
@@ -99,12 +99,14 @@ goog.addDependency("../../../" + dir + "/core/renderers/common/constants.js", ['
goog.addDependency("../../../" + dir + "/core/renderers/common/debugger.js", ['Blockly.blockRendering.Debug'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types']);
goog.addDependency("../../../" + dir + "/core/renderers/common/drawer.js", ['Blockly.blockRendering.Drawer'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/common/info.js", ['Blockly.blockRendering.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection']);
goog.addDependency("../../../" + dir + "/core/renderers/common/renderer.js", ['Blockly.blockRendering.Renderer'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.Drawer', 'Blockly.blockRendering.RenderInfo']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/drawer.js", ['Blockly.geras.Drawer'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Drawer', 'Blockly.geras.Highlighter', 'Blockly.geras.RenderInfo', 'Blockly.utils.object', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/common/path_object.js", ['Blockly.blockRendering.IPathObject', 'Blockly.blockRendering.PathObject'], ['Blockly.utils.dom']);
goog.addDependency("../../../" + dir + "/core/renderers/common/renderer.js", ['Blockly.blockRendering.Renderer'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.Drawer', 'Blockly.blockRendering.IPathObject', 'Blockly.blockRendering.PathObject', 'Blockly.blockRendering.RenderInfo']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/drawer.js", ['Blockly.geras.Drawer'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Drawer', 'Blockly.geras.Highlighter', 'Blockly.geras.PathObject', 'Blockly.geras.RenderInfo', 'Blockly.utils.object', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/highlight_constants.js", ['Blockly.geras.HighlightConstantProvider'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/highlighter.js", ['Blockly.geras.Highlighter'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/info.js", ['Blockly.geras', 'Blockly.geras.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/renderer.js", ['Blockly.geras.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.Renderer', 'Blockly.geras.Drawer', 'Blockly.geras.HighlightConstantProvider', 'Blockly.geras.RenderInfo', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/path_object.js", ['Blockly.geras.PathObject'], ['Blockly.blockRendering.IPathObject', 'Blockly.utils.dom']);
goog.addDependency("../../../" + dir + "/core/renderers/geras/renderer.js", ['Blockly.geras.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.geras.Drawer', 'Blockly.geras.HighlightConstantProvider', 'Blockly.geras.PathObject', 'Blockly.geras.RenderInfo', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/measurables/base.js", ['Blockly.blockRendering.Measurable'], ['Blockly.blockRendering.Types']);
goog.addDependency("../../../" + dir + "/core/renderers/measurables/connections.js", ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/measurables/inputs.js", ['Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputConnection', 'Blockly.blockRendering.StatementInput'], ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
@@ -112,12 +114,12 @@ goog.addDependency("../../../" + dir + "/core/renderers/measurables/row_elements
goog.addDependency("../../../" + dir + "/core/renderers/measurables/rows.js", ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.TopRow'], ['Blockly.blockRendering.InputConnection', 'Blockly.blockRendering.InRowSpacer', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/measurables/types.js", ['Blockly.blockRendering.Types'], []);
goog.addDependency("../../../" + dir + "/core/renderers/thrasos/info.js", ['Blockly.thrasos', 'Blockly.thrasos.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/thrasos/renderer.js", ['Blockly.thrasos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.Drawer', 'Blockly.blockRendering.Renderer', 'Blockly.thrasos.RenderInfo', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/thrasos/renderer.js", ['Blockly.thrasos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.thrasos.RenderInfo', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/constants.js", ['Blockly.zelos.ConstantProvider'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.utils.object', 'Blockly.utils.svgPaths']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/drawer.js", ['Blockly.zelos.Drawer'], ['Blockly.blockRendering.ConstantProvider', 'Blockly.blockRendering.Drawer', 'Blockly.blockRendering.Types', 'Blockly.utils.object', 'Blockly.zelos.RenderInfo']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/info.js", ['Blockly.zelos', 'Blockly.zelos.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.RenderedConnection', 'Blockly.utils.object', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow', 'Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/measurables/rows.js", ['Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.SpacerRow', 'Blockly.utils.object']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/renderer.js", ['Blockly.zelos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Debug', 'Blockly.blockRendering.Renderer', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.RenderInfo']);
goog.addDependency("../../../" + dir + "/core/renderers/zelos/renderer.js", ['Blockly.zelos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.RenderInfo']);
goog.addDependency("../../../" + dir + "/core/scrollbar.js", ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
goog.addDependency("../../../" + dir + "/core/theme.js", ['Blockly.Theme'], []);
goog.addDependency("../../../" + dir + "/core/theme/classic.js", ['Blockly.Themes.Classic'], ['Blockly.Theme']);
@@ -283,6 +285,7 @@ goog.require('Blockly.blockRendering.Drawer');
goog.require('Blockly.blockRendering.ExternalValueInput');
goog.require('Blockly.blockRendering.Field');
goog.require('Blockly.blockRendering.Hat');
goog.require('Blockly.blockRendering.IPathObject');
goog.require('Blockly.blockRendering.Icon');
goog.require('Blockly.blockRendering.InRowSpacer');
goog.require('Blockly.blockRendering.InlineInput');
@@ -292,6 +295,7 @@ goog.require('Blockly.blockRendering.JaggedEdge');
goog.require('Blockly.blockRendering.Measurable');
goog.require('Blockly.blockRendering.NextConnection');
goog.require('Blockly.blockRendering.OutputConnection');
goog.require('Blockly.blockRendering.PathObject');
goog.require('Blockly.blockRendering.PreviousConnection');
goog.require('Blockly.blockRendering.RenderInfo');
goog.require('Blockly.blockRendering.Renderer');
@@ -308,6 +312,7 @@ goog.require('Blockly.geras');
goog.require('Blockly.geras.Drawer');
goog.require('Blockly.geras.HighlightConstantProvider');
goog.require('Blockly.geras.Highlighter');
goog.require('Blockly.geras.PathObject');
goog.require('Blockly.geras.RenderInfo');
goog.require('Blockly.geras.Renderer');
goog.require('Blockly.inject');

View File

@@ -32,40 +32,6 @@ goog.require('Blockly.BlockSvg');
goog.require('Blockly.utils.dom');
/**
* An object that holds information about the paths that are used to render the
* block. Each path is built up as an array of steps during the render process.
* The arrays are then turned into strings, which are set in the block's SVG.
* @constructor
* @struct
* @private
*/
Blockly.BlockSvg.PathObject = function() {
/**
* The primary outline of the block.
* @type {!Array.<string|number>}
*/
this.steps = [];
/**
* The highlight on the primary outline of the block.
* @type {!Array.<string|number>}
*/
this.highlightSteps = [];
/**
* The holes in the block for inline inputs.
* @type {!Array.<string|number>}
*/
this.inlineSteps = [];
/**
* The highlights on holes in the block for inline inputs.
* @type {!Array.<string|number>}
*/
this.highlightInlineSteps = [];
};
// UI constants for rendering blocks.
/**
* Vertical space between elements.
@@ -108,30 +74,6 @@ Blockly.BlockSvg.prototype.getHeightWidth = function() {
return {height: height, width: width};
};
/**
* Update the block's SVG paths based on the paths that were computed during
* this render pass.
* @param {!Blockly.BlockSvg.PathObject} pathObject The object containing
* partially constructed SVG paths, which will be modified by this function.
* @private
*/
Blockly.BlockSvg.prototype.setPaths_ = function(pathObject) {
var pathString = pathObject.steps.join(' ') + '\n' +
pathObject.inlineSteps.join(' ');
this.svgPath_.setAttribute('d', pathString);
this.svgPathDark_.setAttribute('d', pathString);
pathString = pathObject.highlightSteps.join(' ') + '\n' +
pathObject.highlightInlineSteps.join(' ');
this.svgPathLight_.setAttribute('d', pathString);
if (this.RTL) {
// Mirror the block's path.
this.svgPath_.setAttribute('transform', 'scale(-1 1)');
this.svgPathLight_.setAttribute('transform', 'scale(-1 1)');
this.svgPathDark_.setAttribute('transform', 'translate(1,1) scale(-1 1)');
}
};
/**
* Position an new block correctly, so that it doesn't move the existing block
* when connected to it.

View File

@@ -28,6 +28,7 @@ goog.provide('Blockly.BlockSvg');
goog.require('Blockly.Block');
goog.require('Blockly.blockAnimations');
goog.require('Blockly.blockRendering.IPathObject');
goog.require('Blockly.ContextMenu');
goog.require('Blockly.Events');
goog.require('Blockly.Events.Ui');
@@ -65,26 +66,35 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) {
this.svgGroup_.translate_ = '';
/**
* The renderer's path object.
* @type {Blockly.blockRendering.IPathObject}
* @package
*/
this.pathObject =
workspace.getRenderer().makePathObject(this.svgGroup_);
// The next three paths are set only for backwards compatibility reasons.
/**
* The dark path of the block.
* @type {SVGElement}
* @private
*/
this.svgPathDark_ = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathDark', 'transform': 'translate(1,1)'},
this.svgGroup_);
this.svgPathDark_ = this.pathObject.svgPathDark || null;
/**
* The primary path of the block.
* @type {SVGElement}
* @private
*/
this.svgPath_ = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPath'}, this.svgGroup_);
this.svgPath_ = this.pathObject.svgPath || null;
/**
* The light path of the block.
* @type {SVGElement}
* @private
*/
this.svgPathLight_ = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathLight'}, this.svgGroup_);
this.svgPathLight_ = this.pathObject.svgPathLight || null;
this.svgPath_.tooltip = this;
/** @type {boolean} */
@@ -1537,7 +1547,7 @@ Blockly.BlockSvg.prototype.positionNearConnection = function(sourceConnection,
}
};
/*
/**
* Render the block.
* Lays out and reflows a block based on its contents and settings.
* @param {boolean=} opt_bubble If false, just render this block.

View File

@@ -70,7 +70,7 @@ Blockly.blockRendering.ConstantProvider = function() {
/**
* Rounded corner radius.
* @const
* @type {number}
*/
this.CORNER_RADIUS = 8;

View File

@@ -278,7 +278,9 @@ Blockly.blockRendering.Debug.prototype.drawRenderedRow = function(row, cursorY,
Blockly.blockRendering.Debug.prototype.drawRowWithElements = function(row, cursorY, isRtl) {
for (var i = 0, elem; (elem = row.elements[i]); i++) {
if (Blockly.blockRendering.Types.isSpacer(elem)) {
this.drawSpacerElem(elem, row.height, isRtl);
this.drawSpacerElem(
/** @type {Blockly.blockRendering.InRowSpacer} */ (elem),
row.height, isRtl);
} else {
this.drawRenderedElem(elem, isRtl);
}

View File

@@ -76,13 +76,7 @@ Blockly.blockRendering.Drawer.prototype.draw = function() {
this.drawOutline_();
this.drawInternals_();
var pathObject = new Blockly.BlockSvg.PathObject();
pathObject.steps = [this.outlinePath_];
pathObject.inlineSteps = [this.inlinePath_];
this.block_.setPaths_(pathObject);
this.block_.pathObject.setPaths(this.outlinePath_ + '\n' + this.inlinePath_);
if (Blockly.blockRendering.useDebugger) {
this.block_.renderingDebugger.drawDebug(this.block_, this.info_);
}
@@ -91,8 +85,8 @@ Blockly.blockRendering.Drawer.prototype.draw = function() {
/**
* Save sizing information back to the block
* Most of the rendering information can be thrown away at the end of the render.
* Anything that needs to be kept around should be set in this function.
* Most of the rendering information can be thrown away at the end of the
* render. Anything that needs to be kept around should be set in this function.
* @protected
*/
Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_ = function() {
@@ -300,10 +294,13 @@ Blockly.blockRendering.Drawer.prototype.drawInternals_ = function() {
for (var i = 0, row; (row = this.info_.rows[i]); i++) {
for (var j = 0, elem; (elem = row.elements[j]); j++) {
if (Blockly.blockRendering.Types.isInlineInput(elem)) {
this.drawInlineInput_(elem);
this.drawInlineInput_(
/** @type {!Blockly.blockRendering.InlineInput} */ (elem));
} else if (Blockly.blockRendering.Types.isIcon(elem) ||
Blockly.blockRendering.Types.isField(elem)) {
this.layoutField_(elem);
this.layoutField_(
/** @type {!Blockly.blockRendering.Field|!Blockly.blockRendering.Icon} */
(elem));
}
}
}
@@ -350,7 +347,7 @@ Blockly.blockRendering.Drawer.prototype.layoutField_ = function(fieldInfo) {
/**
* Add steps for an inline input.
* @param {Blockly.blockRendering.InlineInput} input The information about the
* @param {!Blockly.blockRendering.InlineInput} input The information about the
* input to render.
* @protected
*/

View File

@@ -213,7 +213,7 @@ Blockly.blockRendering.RenderInfo.prototype.createRows_ = function() {
}
}
var lastInput = undefined;
var lastInput = null;
// Loop across all of the inputs on the block, creating objects for anything
// that needs to be rendered and breaking the block up into visual rows.
for (var i = 0, input; (input = this.block_.inputList[i]); i++) {
@@ -279,8 +279,8 @@ Blockly.blockRendering.RenderInfo.prototype.addInput_ = function(input, activeRo
/**
* Decide whether to start a new row between the two Blockly.Inputs.
* @param {!Blockly.Input} input The first input to consider
* @param {Blockly.Input} lastInput The input that follows.
* @param {!Blockly.Input} input The first input to consider
* @param {Blockly.Input} lastInput The input that follows.
* @return {boolean} True if the next input should be rendered on a new row.
* @protected
*/
@@ -403,7 +403,7 @@ Blockly.blockRendering.RenderInfo.prototype.alignRowElements_ = function() {
for (var i = 0, row; (row = this.rows[i]); i++) {
if (row.hasStatement) {
this.alignStatementRow_(
/** @type {Blockly.RenderedConnection} */ (row));
/** @type {!Blockly.blockRendering.InputRow} */ (row));
} else {
var currentWidth = row.width;
var desiredWidth = this.width - this.startX;

View File

@@ -0,0 +1,96 @@
/**
* @license
* Visual Blocks Editor
*
* Copyright 2019 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview An object that owns a block's rendering SVG elements.
* @author fenichel@google.com (Rachel Fenichel)
*/
'use strict';
goog.provide('Blockly.blockRendering.IPathObject');
goog.provide('Blockly.blockRendering.PathObject');
goog.require('Blockly.utils.dom');
/**
* An interface for a block's path object.
* @param {!SVGElement} _root The root SVG element.
* @interface
* @package
*/
Blockly.blockRendering.IPathObject = function(_root) {};
/**
* An object that handles creating and setting each of the SVG elements
* used by the renderer.
* @param {!SVGElement} root The root SVG element.
* @constructor
* @implements {Blockly.blockRendering.IPathObject}
* @package
*/
Blockly.blockRendering.PathObject = function(root) {
this.svgRoot = root;
/**
* The primary path of the block.
* @type {SVGElement}
* @package
*/
this.svgPath = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPath'}, this.svgRoot);
// The light and dark paths need to exist (for now) because there is colouring
// code in block_svg that depends on them. But we will always set them to
// display: none, and eventually we want to remove them entirely.
/**
* The light path of the block.
* @type {SVGElement}
* @package
*/
this.svgPathLight = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathLight'}, this.svgRoot);
/**
* The dark path of the block.
* @type {SVGElement}
* @package
*/
this.svgPathDark = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathDark', 'transform': 'translate(1,1)'},
this.svgRoot);
};
/**
* Set the path generated by the renderer onto the respective SVG element.
* @param {string} pathString The path.
* @package
*/
Blockly.blockRendering.PathObject.prototype.setPaths = function(pathString) {
this.svgPath.setAttribute('d', pathString);
if (this.RTL) {
// Mirror the block's path.
this.svgPath.setAttribute('transform', 'scale(-1 1)');
}
this.svgPathLight.style.display = 'none';
this.svgPathDark.style.display = 'none';
};

View File

@@ -29,6 +29,8 @@ goog.provide('Blockly.blockRendering.Renderer');
goog.require('Blockly.blockRendering.ConstantProvider');
goog.require('Blockly.blockRendering.Debug');
goog.require('Blockly.blockRendering.Drawer');
goog.require('Blockly.blockRendering.IPathObject');
goog.require('Blockly.blockRendering.PathObject');
goog.require('Blockly.blockRendering.RenderInfo');
@@ -96,6 +98,16 @@ Blockly.blockRendering.Renderer.prototype.makeDebugger_ = function() {
return new Blockly.blockRendering.Debug();
};
/**
* Create a new instance of a renderer path object.
* @param {!SVGElement} root The root SVG element.
* @return {!Blockly.blockRendering.IPathObject} The renderer path object.
* @package
*/
Blockly.blockRendering.Renderer.prototype.makePathObject = function(root) {
return new Blockly.blockRendering.PathObject(root);
};
/**
* Get the current renderer's constant provider. We assume that when this is
* called, the renderer has already been initialized.
@@ -121,3 +133,4 @@ Blockly.blockRendering.Renderer.prototype.render = function(block) {
info.measure();
this.makeDrawer_(block, info).draw();
};

View File

@@ -29,6 +29,7 @@ goog.provide('Blockly.geras.Drawer');
goog.require('Blockly.blockRendering.ConstantProvider');
goog.require('Blockly.blockRendering.Drawer');
goog.require('Blockly.geras.Highlighter');
goog.require('Blockly.geras.PathObject');
goog.require('Blockly.geras.RenderInfo');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.svgPaths');
@@ -59,13 +60,9 @@ Blockly.geras.Drawer.prototype.draw = function() {
this.drawOutline_();
this.drawInternals_();
var pathObject = new Blockly.BlockSvg.PathObject();
pathObject.steps = [this.outlinePath_];
pathObject.inlineSteps = [this.inlinePath_];
pathObject.highlightSteps = [this.highlighter_.getSteps()];
pathObject.highlightInlineSteps = [this.highlighter_.getInlineSteps()];
this.block_.pathObject.setPaths(this.outlinePath_ + '\n' + this.inlinePath_,
this.highlighter_.getPath());
this.block_.setPaths_(pathObject);
if (Blockly.blockRendering.useDebugger) {
this.block_.renderingDebugger.drawDebug(this.block_, this.info_);
}

View File

@@ -90,21 +90,12 @@ Blockly.geras.Highlighter = function(info) {
};
/**
* Get the steps for the main highlight path.
* @return {string} The steps for the main highlight path.
* Get the steps for the highlight path.
* @return {string} The steps for the highlight path.
* @package
*/
Blockly.geras.Highlighter.prototype.getSteps = function() {
return this.steps_;
};
/**
* Get the steps for the inline highlight path.
* @return {string} The steps for the inline highlight path.
* @package
*/
Blockly.geras.Highlighter.prototype.getInlineSteps = function() {
return this.inlineSteps_;
Blockly.geras.Highlighter.prototype.getPath = function() {
return this.steps_ + '\n' + this.inlineSteps_;
};
Blockly.geras.Highlighter.prototype.drawTopCorner = function(row) {

View File

@@ -158,13 +158,13 @@ Blockly.geras.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between an icon and an icon or field.
if (Blockly.blockRendering.Types.isIcon(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
return this.constants_.LARGE_PADDING;
}
// Spacing between an inline input and a field.
if (Blockly.blockRendering.Types.isInlineInput(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
// Editable field after inline input.
if (next.isEditable) {
return this.constants_.MEDIUM_PADDING;
@@ -206,7 +206,7 @@ Blockly.geras.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between two fields of the same editability.
if (!Blockly.blockRendering.Types.isInput(prev) &&
!Blockly.blockRendering.Types.isInput(next) &&
next && !Blockly.blockRendering.Types.isInput(next) &&
(prev.isEditable == next.isEditable)) {
return this.constants_.LARGE_PADDING;
}

View File

@@ -0,0 +1,91 @@
/**
* @license
* Visual Blocks Editor
*
* Copyright 2019 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview An object that owns a block's rendering SVG elements.
* @author fenichel@google.com (Rachel Fenichel)
*/
'use strict';
goog.provide('Blockly.geras.PathObject');
goog.require('Blockly.blockRendering.IPathObject');
goog.require('Blockly.utils.dom');
/**
* An object that handles creating and setting each of the SVG elements
* used by the renderer.
* @param {!SVGElement} root The root SVG element.
* @constructor
* @implements {Blockly.blockRendering.IPathObject}
* @package
*/
Blockly.geras.PathObject = function(root) {
this.svgRoot = root;
// The order of creation for these next three matters, because that
// effectively sets their z-indices.
/**
* The dark path of the block.
* @type {SVGElement}
* @package
*/
this.svgPathDark = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathDark', 'transform': 'translate(1,1)'},
this.svgRoot);
/**
* The primary path of the block.
* @type {SVGElement}
* @package
*/
this.svgPath = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPath'}, this.svgRoot);
/**
* The light path of the block.
* @type {SVGElement}
* @package
*/
this.svgPathLight = Blockly.utils.dom.createSvgElement('path',
{'class': 'blocklyPathLight'}, this.svgRoot);
};
/**
* Set each of the paths generated by the renderer onto the respective SVG element.
* @param {string} mainPath The main path.
* @param {string} highlightPath The highlight path.
* @package
*/
Blockly.geras.PathObject.prototype.setPaths = function(mainPath, highlightPath) {
this.svgPath.setAttribute('d', mainPath);
this.svgPathDark.setAttribute('d', mainPath);
this.svgPathLight.setAttribute('d', highlightPath);
if (this.RTL) {
// Mirror the block's path.
this.svgPath.setAttribute('transform', 'scale(-1 1)');
this.svgPathLight.setAttribute('transform', 'scale(-1 1)');
this.svgPathDark.setAttribute('transform', 'translate(1,1) scale(-1 1)');
}
};

View File

@@ -30,6 +30,7 @@ goog.require('Blockly.blockRendering');
goog.require('Blockly.blockRendering.Renderer');
goog.require('Blockly.geras.Drawer');
goog.require('Blockly.geras.HighlightConstantProvider');
goog.require('Blockly.geras.PathObject');
goog.require('Blockly.geras.RenderInfo');
goog.require('Blockly.utils.object');
@@ -89,6 +90,16 @@ Blockly.geras.Renderer.prototype.makeDrawer_ = function(block, info) {
/** @type {!Blockly.geras.RenderInfo} */ (info));
};
/**
* Create a new instance of a renderer path object.
* @param {!SVGElement} root The root SVG element.
* @return {!Blockly.geras.PathObject} The renderer path object.
* @package
* @override
*/
Blockly.geras.Renderer.prototype.makePathObject = function(root) {
return new Blockly.geras.PathObject(root);
};
/**
* Create a new instance of the renderer's highlight constant provider.

View File

@@ -315,7 +315,7 @@ Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner = function(block) {
var prevBlock = block.getPreviousBlock();
return !!block.outputConnection ||
hasHat || (prevBlock && prevBlock.getNextBlock() == block);
hasHat || (prevBlock ? prevBlock.getNextBlock() == block : false);
};
/**

View File

@@ -158,13 +158,13 @@ Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between an icon and an icon or field.
if (Blockly.blockRendering.Types.isIcon(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
return this.constants_.LARGE_PADDING;
}
// Spacing between an inline input and a field.
if (Blockly.blockRendering.Types.isInlineInput(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
// Editable field after inline input.
if (next.isEditable) {
return this.constants_.MEDIUM_PADDING;
@@ -193,7 +193,7 @@ Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between two fields of the same editability.
if (!Blockly.blockRendering.Types.isInput(prev) &&
!Blockly.blockRendering.Types.isInput(next) &&
next && !Blockly.blockRendering.Types.isInput(next) &&
(prev.isEditable == next.isEditable)) {
return this.constants_.LARGE_PADDING;
}

View File

@@ -43,18 +43,39 @@ Blockly.zelos.ConstantProvider = function() {
this.GRID_UNIT = 4;
/**
* @override
*/
this.CORNER_RADIUS = 1 * this.GRID_UNIT;
/**
* @override
*/
this.NOTCH_WIDTH = 9 * this.GRID_UNIT;
/**
* @override
*/
this.NOTCH_HEIGHT = 2 * this.GRID_UNIT;
/**
* @override
*/
this.NOTCH_OFFSET_LEFT = 3 * this.GRID_UNIT;
/**
* @override
*/
this.MIN_BLOCK_HEIGHT = 12 * this.GRID_UNIT;
/**
* @override
*/
this.DARK_PATH_OFFSET = 0;
/**
* @override
*/
this.TAB_OFFSET_FROM_TOP = 0;
};

View File

@@ -187,13 +187,13 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between an icon and an icon or field.
if (Blockly.blockRendering.Types.isIcon(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
return this.constants_.LARGE_PADDING;
}
// Spacing between an inline input and a field.
if (Blockly.blockRendering.Types.isInlineInput(prev) &&
!Blockly.blockRendering.Types.isInput(next)) {
next && !Blockly.blockRendering.Types.isInput(next)) {
// Editable field after inline input.
if (next.isEditable) {
return this.constants_.MEDIUM_PADDING;
@@ -225,7 +225,7 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
// Spacing between two fields of the same editability.
if (!Blockly.blockRendering.Types.isInput(prev) &&
!Blockly.blockRendering.Types.isInput(next) &&
next && !Blockly.blockRendering.Types.isInput(next) &&
(prev.isEditable == next.isEditable)) {
return this.constants_.LARGE_PADDING;
}

View File

@@ -124,7 +124,7 @@ Blockly.longStart_ = function(e, gesture) {
/**
* Nope, that's not a long-press. Either touchend or touchcancel was fired,
* or a drag hath begun. Kill the queued long-press task.
* @private
* @package
*/
Blockly.longStop_ = function() {
if (Blockly.longPid_) {