diff --git a/blockly_compressed.js b/blockly_compressed.js index 782503098..e113ab4b1 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -114,7 +114,7 @@ Blockly.utils.dom.createSvgElement=function(a,b,c){a=document.createElementNS(Bl Blockly.utils.dom.removeClass=function(a,b){var c=a.getAttribute("class");if(-1==(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(var d=0;db?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)}; +Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render())}; +Blockly.RenderedConnection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);b=this.targetBlock();if(!b)throw Error("Couldn't respawn the shadow block that should exist here.");b.initSvg();b.render(!1);a.rendered&&a.render()}};Blockly.RenderedConnection.prototype.neighbours_=function(a){return this.dbOpposite_.getNeighbours(this,a)}; +Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();b.rendered&&b.updateDisabled();a.rendered&&a.updateDisabled();b.rendered&&a.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?a.render():b.render())}; +Blockly.RenderedConnection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())};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};goog.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};goog.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection); +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};goog.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};goog.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};goog.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; +this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width};goog.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};goog.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};goog.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};goog.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};goog.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};goog.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.startY=this.height};goog.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.height=this.constants_.NOTCH.height;this.width=this.constants_.NO_PADDING};goog.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_.NOTCH.height};goog.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};goog.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.startY=0;this.hasPreviousConnection=!1;this.connection=null};goog.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.startY=b.startY):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.TopRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];a++)this.width+=b.width,Blockly.blockRendering.Types.isSpacer(b)||(Blockly.blockRendering.Types.isHat(b)&&(this.startY=b.startY,this.height+=b.height),this.height=Math.max(this.height,b.height));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.overhangY=0};goog.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_.NOTCH.height;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.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];a++)this.width+=b.width,Blockly.blockRendering.Types.isSpacer(b)||(Blockly.blockRendering.Types.isNextConnection(b)&&(this.height+=b.height,this.overhangY=b.height),this.height=Math.max(this.height,b.height));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)]};goog.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};goog.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?!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;dthis.highlightOffset_&&this.steps_.push("V",a.yPos+a.height-this.highlightOffset_))}; +Blockly.geras.Highlighter.prototype.drawBottomRow=function(a){var b=a.yPos+a.height-a.overhangY;if(this.RTL_)this.steps_.push("V",b-this.highlightOffset_);else{var c=this.info_.bottomRow.elements[0];Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,b-this.highlightOffset_)):Blockly.blockRendering.Types.isLeftRoundedCorner(c)&&(this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos,b)),this.steps_.push(this.outsideCornerPaths_.bottomLeft()))}}; +Blockly.geras.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX,a)):(this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.height-this.highlightOffset_)),this.steps_.push("V",a)),this.steps_.push(this.puzzleTabPaths_.pathUp(this.RTL_)));this.RTL_||(a=this.info_.topRow,Blockly.blockRendering.Types.isLeftRoundedCorner(a.elements[0])? +this.steps_.push("V",this.outsideCornerPaths_.height):this.steps_.push("V",a.startY+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,b=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)):b=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_);this.inlineSteps_.push(b)};Blockly.geras.RenderInfo=function(a){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.geras.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1}; +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.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}; +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||b.hasDummyInput? +this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};Blockly.geras.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;if(Blockly.blockRendering.Types.isField(b)||Blockly.blockRendering.Types.isIcon(b)){if(c+=b.height/2,a.hasInlineInput||a.hasStatement)c+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y}else c=Blockly.blockRendering.Types.isInlineInput(b)?c+b.height/2:Blockly.blockRendering.Types.isNextConnection(b)?c+(a.height-a.overhangY+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.startY;d==this.bottomRow&&e=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(;ba.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)}; @@ -289,10 +455,11 @@ Blockly.ConnectionDB.prototype.searchForClosest=function(a,b,c){if(!this.connect d;return{connection:c,radius:g}};Blockly.ConnectionDB.init=function(){var a=[];a[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB;a[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB;return a};Blockly.constants={};Blockly.LINE_MODE_MULTIPLIER=40;Blockly.PAGE_MODE_MULTIPLIER=125;Blockly.DRAG_RADIUS=5;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly.SNAP_RADIUS=28;Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS;Blockly.CURRENT_CONNECTION_PREFERENCE=8;Blockly.INSERTION_MARKER_COLOUR="#000000";Blockly.BUMP_DELAY=250;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65; Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE; Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE"; -Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.CursorSvg=function(a,b){Blockly.CursorSvg.superClass_.constructor.call(this,b);this.workspace_=a};goog.inherits(Blockly.CursorSvg,Blockly.Cursor);Blockly.CursorSvg.CURSOR_HEIGHT=5;Blockly.CursorSvg.CURSOR_WIDTH=100;Blockly.CursorSvg.NOTCH_START_LENGTH=24;Blockly.CursorSvg.VERTICAL_PADDING=5;Blockly.CursorSvg.STACK_PADDING=10;Blockly.CursorSvg.CURSOR_COLOR="#cc0a0a";Blockly.CursorSvg.MARKER_COLOR="#4286f4";Blockly.CursorSvg.prototype.parent_=null; -Blockly.CursorSvg.prototype.currentCursorSvg=null;Blockly.CursorSvg.prototype.getSvgRoot=function(){return this.svgGroup_};Blockly.CursorSvg.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyCursor"},null);this.createCursorSvg_();return this.svgGroup_};Blockly.CursorSvg.prototype.setParent_=function(a){if(a!=this.parent_){var b=this.getSvgRoot();a&&(a.appendChild(b),this.parent_=a)}}; +Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.CursorSvg=function(a,b){Blockly.CursorSvg.superClass_.constructor.call(this,b);this.workspace_=a;this.constants=new Blockly.blockRendering.ConstantProvider;this.constants.init()};goog.inherits(Blockly.CursorSvg,Blockly.Cursor);Blockly.CursorSvg.CURSOR_HEIGHT=5;Blockly.CursorSvg.CURSOR_WIDTH=100;Blockly.CursorSvg.NOTCH_START_LENGTH=24;Blockly.CursorSvg.VERTICAL_PADDING=5;Blockly.CursorSvg.STACK_PADDING=10;Blockly.CursorSvg.CURSOR_COLOR="#cc0a0a";Blockly.CursorSvg.MARKER_COLOR="#4286f4"; +Blockly.CursorSvg.CURSOR_CLASS="blocklyCursor";Blockly.CursorSvg.MARKER_CLASS="blocklyMarker";Blockly.CursorSvg.prototype.parent_=null;Blockly.CursorSvg.prototype.currentCursorSvg=null;Blockly.CursorSvg.prototype.getSvgRoot=function(){return this.svgGroup_};Blockly.CursorSvg.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":this.isMarker_?Blockly.CursorSvg.MARKER_CLASS:Blockly.CursorSvg.CURSOR_CLASS},null);this.createCursorSvg_();return this.svgGroup_}; +Blockly.CursorSvg.prototype.setParent_=function(a){if(a!=this.parent_){var b=this.getSvgRoot(),c=null;if(a){if(this.isMarker_){for(var d=0,e;e=a.childNodes[d];d++)Blockly.utils.dom.hasClass(e,Blockly.CursorSvg.CURSOR_CLASS)&&(c=e);a.insertBefore(b,c)}else a.appendChild(b);this.parent_=a}}}; Blockly.CursorSvg.prototype.showWithCoordinates_=function(){var a=this.getCurNode().getWsCoordinate();this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(this.workspace_.svgBlockCanvas_);this.positionLine_(a.x,a.y,Blockly.CursorSvg.CURSOR_WIDTH);this.showCurrent_()};Blockly.CursorSvg.prototype.showWithBlock_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorSvgRect_;this.setParent_(a.getSvgRoot());this.positionRect_(0,0,a.width,a.height);this.showCurrent_()}; -Blockly.CursorSvg.prototype.showWithInputOutput_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorInputOutput_;var b=Blockly.utils.svgPaths.moveTo(0,0)+Blockly.blockRendering.constants.PUZZLE_TAB.pathDown;this.cursorInputOutput_.setAttribute("d",b);this.setParent_(a.getSourceBlock().getSvgRoot());this.positionInputOutput_(a);this.showCurrent_()}; +Blockly.CursorSvg.prototype.showWithInputOutput_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorInputOutput_;var b=Blockly.utils.svgPaths.moveTo(0,0)+this.constants.shapeFor(a).pathDown;this.cursorInputOutput_.setAttribute("d",b);this.setParent_(a.getSourceBlock().getSvgRoot());this.positionInputOutput_(a);this.showCurrent_()}; Blockly.CursorSvg.prototype.showWithNext_=function(){var a=this.getCurNode().getLocation(),b=a.getSourceBlock(),c=a.getOffsetInBlock().y;b=b.getHeightWidth().width;this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(a.getSourceBlock().getSvgRoot());this.positionLine_(0,c,b);this.showCurrent_()}; Blockly.CursorSvg.prototype.showWithPrev_=function(){var a=this.getCurNode().getLocation(),b=a.getSourceBlock().getHeightWidth().width;this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(a.getSourceBlock().getSvgRoot());this.positionLine_(0,0,b);this.showCurrent_()}; Blockly.CursorSvg.prototype.showWithField_=function(){var a=this.getCurNode().getLocation(),b=a.borderRect_.width.baseVal.value,c=a.borderRect_.height.baseVal.value;this.currentCursorSvg=this.cursorSvgRect_;this.setParent_(a.getSvgRoot());this.positionRect_(0,0,b,c);this.showCurrent_()}; @@ -311,20 +478,7 @@ Blockly.blockAnimations.connectionUiEffect=function(a){var b=a.workspace,c=b.sca Blockly.blockAnimations.connectionUiStep_=function(a,b,c){var d=(new Date-b)/150;1a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);Blockly.blockAnimations.disconnectUiStep_(a.getSvgRoot(),b,new Date)}}; Blockly.blockAnimations.disconnectUiStep_=function(a,b,c){var d=(new Date-c)/200;1b?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)}; -Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render())}; -Blockly.RenderedConnection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);b=this.targetBlock();if(!b)throw Error("Couldn't respawn the shadow block that should exist here.");b.initSvg();b.render(!1);a.rendered&&a.render()}};Blockly.RenderedConnection.prototype.neighbours_=function(a){return this.dbOpposite_.getNeighbours(this,a)}; -Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();b.rendered&&b.updateDisabled();a.rendered&&a.updateDisabled();b.rendered&&a.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?a.render():b.render())}; -Blockly.RenderedConnection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())};Blockly.InsertionMarkerManager=function(a){this.topBlock_=Blockly.selected=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.markerConnection_=null;this.highlightingBlock_=!1;this.highlightedBlock_=null;this.availableConnections_=this.initAvailableConnections_()}; +Blockly.blockAnimations.disconnectUiStop=function(){if(Blockly.blockAnimations.disconnectGroup_){clearTimeout(Blockly.blockAnimations.disconnectPid_);var a=Blockly.blockAnimations.disconnectGroup_;a.skew_="";a.setAttribute("transform",a.translate_);Blockly.blockAnimations.disconnectGroup_=null}};Blockly.InsertionMarkerManager=function(a){this.topBlock_=Blockly.selected=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.markerConnection_=null;this.highlightingBlock_=!1;this.highlightedBlock_=null;this.availableConnections_=this.initAvailableConnections_()}; Blockly.InsertionMarkerManager.prototype.dispose=function(){this.workspace_=this.topBlock_=null;this.availableConnections_.length=0;this.localConnection_=this.closestConnection_=null;Blockly.Events.disable();try{this.firstMarker_&&(this.firstMarker_.dispose(),this.firstMarker_=null),this.lastMarker_&&(this.lastMarker_.dispose(),this.lastMarker_=null)}finally{Blockly.Events.enable()}this.highlightedBlock_=null};Blockly.InsertionMarkerManager.prototype.wouldDeleteBlock=function(){return this.wouldDeleteBlock_}; Blockly.InsertionMarkerManager.prototype.wouldConnectBlock=function(){return!!this.closestConnection_}; Blockly.InsertionMarkerManager.prototype.applyConnections=function(){if(this.closestConnection_&&(Blockly.Events.disable(),this.hidePreview_(),Blockly.Events.enable(),this.localConnection_.connect(this.closestConnection_),this.topBlock_.rendered)){var a=this.localConnection_.isSuperior()?this.closestConnection_:this.localConnection_;Blockly.blockAnimations.connectionUiEffect(a.getSourceBlock());this.topBlock_.getRootBlock().bringToFront()}}; @@ -397,7 +551,7 @@ Blockly.Gesture.prototype.updateIsDraggingWorkspace_=function(){if(this.flyout_? Blockly.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0;this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()}; Blockly.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new Blockly.BlockDragger(this.targetBlock_,this.startWorkspace_);this.blockDragger_.startBlockDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_)}; Blockly.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new Blockly.BubbleDragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)}; -Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.hideChaff(!!this.flyout_),Blockly.Tooltip.block(),this.targetBlock_&&(this.targetBlock_.select(),!this.targetBlock_.isInFlyout&&a.shiftKey&&Blockly.navigation.focusWorkspace()), +Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.hideChaff(!!this.flyout_),Blockly.Tooltip.block(),this.targetBlock_&&(this.targetBlock_.select(),!this.targetBlock_.isInFlyout&&a.shiftKey&&Blockly.navigation.enableKeyboardAccessibility()), Blockly.utils.isRightButton(a)?this.handleRightClick(a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||Blockly.longStart_(a,this),this.mouseDownXY_=new Blockly.utils.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))}; Blockly.Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",null,this.handleMove.bind(this));this.onUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",null,this.handleUp.bind(this));a.preventDefault();a.stopPropagation()}; Blockly.Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a);this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_);a.preventDefault();a.stopPropagation()}; @@ -409,11 +563,12 @@ Blockly.Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw Blockly.Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b);this.mostRecentEvent_=a};Blockly.Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b);this.mostRecentEvent_=a}; Blockly.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus();this.startBubble_.select&&this.startBubble_.select()};Blockly.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor_();this.bringBlockToFront_()}; Blockly.Gesture.prototype.doBlockClick_=function(){this.flyout_&&this.flyout_.autoClose?this.targetBlock_.isEnabled()&&(Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump()):Blockly.Events.fire(new Blockly.Events.Ui(this.startBlock_,"click",void 0,void 0));this.bringBlockToFront_();Blockly.Events.setGroup(!1)}; -Blockly.Gesture.prototype.doWorkspaceClick_=function(a){Blockly.keyboardAccessibilityMode=!1;var b=this.creatorWorkspace_;b.cursor.hide();a.shiftKey?(a=new Blockly.utils.Coordinate(a.clientX,a.clientY),a=Blockly.utils.screenToWsCoordinates(b,a),a=Blockly.ASTNode.createWorkspaceNode(b,a),b.cursor.setLocation(a),Blockly.keyboardAccessibilityMode=!0):Blockly.selected&&Blockly.selected.unselect()};Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()}; -Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)};Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))}; -Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)};Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_}; -Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};Blockly.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_}; -Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_};Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};Blockly.Gesture.inProgress=function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id}; +Blockly.Gesture.prototype.doWorkspaceClick_=function(a){Blockly.navigation.disableKeyboardAccessibility();var b=this.creatorWorkspace_;b.cursor.hide();a.shiftKey?(a=new Blockly.utils.Coordinate(a.clientX,a.clientY),a=Blockly.utils.screenToWsCoordinates(b,a),a=Blockly.ASTNode.createWorkspaceNode(b,a),b.cursor.setLocation(a),Blockly.navigation.enableKeyboardAccessibility()):Blockly.selected&&Blockly.selected.unselect()}; +Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()};Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)}; +Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))};Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)}; +Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};Blockly.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)}; +Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_};Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]}; +Blockly.Gesture.inProgress=function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id}; Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b);this.gridPattern_.setAttribute("height",b);b=Math.floor(this.spacing_/2)+.5;var c=b-this.length_/2,d=b+this.length_/2;b*=a;c*=a;d*=a;this.setLineAttributes_(this.line1_,a,c,d,b,b);this.setLineAttributes_(this.line2_,a,b,b,c,d)}; Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))};Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a);this.gridPattern_.setAttribute("y",b);(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)}; Blockly.Grid.createDom=function(a,b,c){a=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);0this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_.RTL&&(a+="\u200f");return a};Blockly.Field.prototype.getText=function(){return this.text_};Blockly.Field.prototype.setText=function(a){null!==a&&(a=String(a),a!==this.text_&&(this.text_=a,this.forceRerender()))}; -Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())}; +Blockly.Field.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return Blockly.Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a};Blockly.Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())}; +Blockly.Field.prototype.setText=function(a){throw Error("setText method is deprecated");};Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())}; Blockly.Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.getValue();b!==a&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,b,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())}}}; -Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return a=this.classValidator(a)};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0;this.text_=String(a)};Blockly.Field.prototype.doValueInvalid_=function(a){}; +Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return a=this.classValidator(a)};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0};Blockly.Field.prototype.doValueInvalid_=function(a){}; Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};Blockly.Field.prototype.setTooltip=function(a){var b=this.getClickTarget_();b?b.tooltip=a||""===a?a:this.sourceBlock_:this.tooltip_=a};Blockly.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()};Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.borderRect_)}; Blockly.Field.prototype.referencesVariables=function(){return!1};Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;dthis.highlightOffset_&&this.steps_.push("V",a.yPos+a.height-this.highlightOffset_))}; -Blockly.blockRendering.Highlighter.prototype.drawBottomRow=function(a){var b=a.yPos+a.height-a.overhangY;if(this.RTL_)this.steps_.push("V",b-this.highlightOffset_);else{var c=this.info_.bottomRow.elements[0];"square corner"==c.type?this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,b-this.highlightOffset_)):"round corner"==c.type&&(this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos,b)),this.steps_.push(this.outsideCornerPaths_.bottomLeft()))}}; -Blockly.blockRendering.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX,a)):(this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.height-this.highlightOffset_)),this.steps_.push("V",a)),this.steps_.push(this.puzzleTabPaths_.pathUp(this.RTL_)));this.RTL_||(a=this.info_.topRow,a.elements[0].isRoundedCorner()?this.steps_.push("V", -this.outsideCornerPaths_.height):this.steps_.push("V",a.startY+this.highlightOffset_))}; -Blockly.blockRendering.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,b=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)):b=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_);this.inlineSteps_.push(b)};Blockly.blockRendering.Debug=function(){this.debugElements_=[];this.svgRoot_=null;this.config_={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!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},this.svgRoot_))}; -Blockly.blockRendering.Debug.prototype.drawSpacerElem=function(a,b,c){if(this.config_.elemSpacers){var d=a.xPos;c&&(d=-(d+a.width));b=Math.min(a.height,b);this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemSpacerRect blockRenderDebug",x:d,y:a.centerline-b/2,width:a.width,height:b},this.svgRoot_))}}; -Blockly.blockRendering.Debug.prototype.drawRenderedElem=function(a,b){if(this.config_.elems){var c=a.xPos;b&&(c=-(c+a.width));this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowRenderingRect blockRenderDebug",x:c,y:a.centerline-a.height/2,width:a.width,height:a.height},this.svgRoot_));a.isInput&&this.drawConnection(a.connection)}}; -Blockly.blockRendering.Debug.prototype.drawConnection=function(a){if(this.config_.connections){if(a.type==Blockly.INPUT_VALUE){var b=4;var c="magenta";var d="none"}else a.type==Blockly.OUTPUT_VALUE?(b=2,d=c="magenta"):a.type==Blockly.NEXT_STATEMENT?(b=4,c="goldenrod",d="none"):a.type==Blockly.PREVIOUS_STATEMENT&&(b=2,d=c="goldenrod");this.debugElements_.push(Blockly.utils.dom.createSvgElement("circle",{"class":"blockRenderDebug",cx:a.offsetInBlock_.x,cy:a.offsetInBlock_.y,r:b,fill:d,stroke:c},this.svgRoot_))}}; -Blockly.blockRendering.Debug.prototype.drawRenderedRow=function(a,b,c){this.config_.rows&&(this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemRenderingRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height},this.svgRoot_)),"top row"!=a.type&&"bottom row"!=a.type&&this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockRenderDebug",x:c?-(a.xPos+a.widthWithConnectedBlocks):a.xPos,y:b,width:a.widthWithConnectedBlocks, -height:a.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))};Blockly.blockRendering.Debug.prototype.drawRowWithElements=function(a,b,c){for(var d=0,e;e=a.elements[d];d++)e.isSpacer()?this.drawSpacerElem(e,a.height,c):this.drawRenderedElem(e,c);this.drawRenderedRow(a,b,c)}; -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},this.svgRoot_));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.config_.rowSpacers=!1;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++)"between-row spacer"==e.type?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.pathObject_=new Blockly.BlockSvg.PathObject;this.highlighter_=new Blockly.blockRendering.Highlighter(this.info_,this.pathObject_)}; -Blockly.blockRendering.Drawer.prototype.draw_=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.pathObject_.steps=[this.outlinePath_];this.pathObject_.inlineSteps=[this.inlinePath_];this.block_.setPaths_(this.pathObject_);this.recordSizeOnBlock_()};Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height+Blockly.blockRendering.constants.DARK_PATH_OFFSET;this.block_.width=this.info_.widthWithChildren+Blockly.blockRendering.constants.DARK_PATH_OFFSET}; -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;aa?b-1:a},this.highlightedIndex_)};Blockly.Menu.prototype.highlightHelper=function(a,b){var c=0>b?-1:b,d=this.getChildCount();c=a.call(this,c,d);for(var e=0;e<=d;){var f=this.getChildAt(c);if(f&&this.canHighlightItem(f))return this.setHighlightedIndex(c),!0;e++;c=a.call(this,c,d)}return!1}; -Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()};Blockly.Menu.prototype.onHighlighted=function(a){this.highlightHandler_=a};Blockly.Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem(a.target))&&a.isEnabled()&&this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a))};Blockly.Menu.prototype.handleMouseUp_=function(a){var b=this.getMenuItem(a.target);b&&b.handleMouseUp(a)&&a.preventDefault()};Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()}; +Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()};Blockly.Menu.prototype.onHighlighted=function(a){this.highlightHandler_=a};Blockly.Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem(a.target))&&a.isEnabled()&&this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a))};Blockly.Menu.prototype.handleClick_=function(a){var b=this.getMenuItem(a.target);b&&b.handleClick(a)&&a.preventDefault()};Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()}; Blockly.Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur(),this.clearHighlighted())};Blockly.Menu.prototype.handleKeyEvent=function(a){return 0!=this.getChildCount()&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; Blockly.Menu.prototype.handleKeyEventInternal=function(a){var b=this.getHighlighted();if(b&&"function"==typeof b.handleKeyEvent&&b.handleKeyEvent(a))return!0;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return!1;switch(a.keyCode){case Blockly.utils.KeyCodes.ENTER:b&&b.performActionInternal(a);break;case Blockly.utils.KeyCodes.UP:this.unhighlightCurrent();this.highlightPrevious();break;case Blockly.utils.KeyCodes.DOWN:this.unhighlightCurrent();this.highlightNext();break;default:return!1}return!0};Blockly.MenuItem=function(a,b){Blockly.Component.call(this);this.setContentInternal(a);this.setValue(b);this.enabled_=!0};goog.inherits(Blockly.MenuItem,Blockly.Component); Blockly.MenuItem.prototype.createDom=function(){var a=document.createElement("div");a.setAttribute("id",this.getId());this.setElementInternal(a);a.setAttribute("class","goog-menuitem goog-option "+(this.enabled_?"":"goog-menuitem-disabled ")+(this.checked_?"goog-option-selected ":"")+(this.isRightToLeft()?"goog-menuitem-rtl ":""));a.setAttribute("style","user-select: none");var b=this.getContentWrapperDom();a.appendChild(b);var c=this.getCheckboxDom();c&&b.appendChild(c);b.appendChild(this.getContentDom()); @@ -868,7 +898,7 @@ Blockly.MenuItem.prototype.getContentDom=function(){var a=this.content_;"string" Blockly.MenuItem.prototype.getValue=function(){return this.value_};Blockly.MenuItem.prototype.setRole=function(a){this.roleName_=a};Blockly.MenuItem.prototype.setCheckable=function(a){this.checkable_=a}; Blockly.MenuItem.prototype.setChecked=function(a){if(this.checkable_){this.checked_=a;var b=this.getElement();b&&this.isEnabled()&&(a?(Blockly.utils.dom.addClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!0)):(Blockly.utils.dom.removeClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!1)))}};Blockly.MenuItem.prototype.isHighlighted=function(){return this.highlight_}; Blockly.MenuItem.prototype.setHighlighted=function(a){this.highlight_=a;var b=this.getElement();b&&this.isEnabled()&&(a?Blockly.utils.dom.addClass(b,"goog-menuitem-highlight"):Blockly.utils.dom.removeClass(b,"goog-menuitem-highlight"))};Blockly.MenuItem.prototype.isEnabled=function(){return this.enabled_};Blockly.MenuItem.prototype.setEnabled=function(a){this.enabled_=a;(a=this.getElement())&&(this.enabled_?Blockly.utils.dom.removeClass(a,"goog-menuitem-disabled"):Blockly.utils.dom.addClass(a,"goog-menuitem-disabled"))}; -Blockly.MenuItem.prototype.handleMouseUp=function(a){this.isEnabled()&&(this.setHighlighted(!0),this.performActionInternal())};Blockly.MenuItem.prototype.performActionInternal=function(){this.checkable_&&this.setChecked(!this.checked_);this.actionHandler_&&this.actionHandler_.call(this.actionHandlerObj_,this)};Blockly.MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a;this.actionHandlerObj_=b};Blockly.utils.uiMenu={};Blockly.utils.uiMenu.getSize=function(a){a=a.getElement();var b=Blockly.utils.style.getSize(a);b.height=a.scrollHeight;return b};Blockly.utils.uiMenu.adjustBBoxesForRTL=function(a,b,c){b.left+=c.width;b.right+=c.width;a.left+=c.width;a.right+=c.width};Blockly.ContextMenu={};Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_=null;Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=Blockly.ContextMenu.populate_(b,c);Blockly.ContextMenu.position_(d,a,c);setTimeout(function(){d.getElement().focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()}; +Blockly.MenuItem.prototype.handleClick=function(a){this.isEnabled()&&(this.setHighlighted(!0),this.performActionInternal())};Blockly.MenuItem.prototype.performActionInternal=function(){this.checkable_&&this.setChecked(!this.checked_);this.actionHandler_&&this.actionHandler_.call(this.actionHandlerObj_,this)};Blockly.MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a;this.actionHandlerObj_=b};Blockly.utils.uiMenu={};Blockly.utils.uiMenu.getSize=function(a){a=a.getElement();var b=Blockly.utils.style.getSize(a);b.height=a.scrollHeight;return b};Blockly.utils.uiMenu.adjustBBoxesForRTL=function(a,b,c){b.left+=c.width;b.right+=c.width;a.left+=c.width;a.right+=c.width};Blockly.ContextMenu={};Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_=null;Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=Blockly.ContextMenu.populate_(b,c);Blockly.ContextMenu.position_(d,a,c);setTimeout(function(){d.getElement().focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()}; Blockly.ContextMenu.populate_=function(a,b){var c=new Blockly.Menu;c.setRightToLeft(b);for(var d=0,e;e=a[d];d++){var f=new Blockly.MenuItem(e.text);f.setRightToLeft(b);c.addChild(f,!0);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(){Blockly.ContextMenu.hide();this.callback()},e)}return c}; Blockly.ContextMenu.position_=function(a,b,c){var d=Blockly.utils.getViewportBBox();b={top:b.clientY+d.top,bottom:b.clientY+d.top,left:b.clientX+d.left,right:b.clientX+d.left};Blockly.ContextMenu.createWidget_(a);var e=Blockly.utils.uiMenu.getSize(a);c&&Blockly.utils.uiMenu.adjustBBoxesForRTL(d,b,e);Blockly.WidgetDiv.positionWithAnchor(d,b,e,c);a.getElement().focus()}; Blockly.ContextMenu.createWidget_=function(a){a.render(Blockly.WidgetDiv.DIV);var b=a.getElement();Blockly.utils.dom.addClass(b,"blocklyContextMenu");Blockly.bindEventWithChecks_(b,"contextmenu",null,Blockly.utils.noEvent);a.focus()};Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_&&Blockly.unbindEvent_(Blockly.ContextMenu.eventWrapper_)}; @@ -922,8 +952,7 @@ Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.Render 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;bc?b+=180:0Blockly.FieldAngle.WRAP?a-=360:0>a&&(a+=360);var b=String(a);b!=this.text_&&(this.htmlInput_.value=a,this.setValue(a),this.text_=b,this.forceRerender())}; +Blockly.FieldAngle.prototype.setAngle=function(a){Blockly.FieldAngle.ROUND&&(a=Math.round(a/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND);a>Blockly.FieldAngle.WRAP?a-=360:0>a&&(a+=360);a!=this.value_&&this.setEditorValue_(a)}; Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var a=Number(this.getText())+Blockly.FieldAngle.OFFSET,b=Blockly.utils.math.toRadians(a%360);a=["M ",Blockly.FieldAngle.HALF,",",Blockly.FieldAngle.HALF];var c=Blockly.FieldAngle.HALF,d=Blockly.FieldAngle.HALF;if(!isNaN(b)){var e=Blockly.utils.math.toRadians(Blockly.FieldAngle.OFFSET),f=Math.cos(e)*Blockly.FieldAngle.RADIUS,g=Math.sin(e)*-Blockly.FieldAngle.RADIUS;Blockly.FieldAngle.CLOCKWISE&&(b=2*e-b);c+=Math.cos(b)*Blockly.FieldAngle.RADIUS; d-=Math.sin(b)*Blockly.FieldAngle.RADIUS;b=Math.abs(Math.floor((b-e)/Math.PI)%2);Blockly.FieldAngle.CLOCKWISE&&(b=1-b);a.push(" l ",f,",",g," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",b," ",Number(Blockly.FieldAngle.CLOCKWISE)," ",c,",",d," z")}this.gauge_.setAttribute("d",a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}}; Blockly.FieldAngle.prototype.onHtmlInputKeyDown_=function(a){Blockly.FieldAngle.superClass_.onHtmlInputKeyDown_.call(this,a);var b;a.keyCode===Blockly.utils.KeyCodes.LEFT?b=this.sourceBlock_.RTL?1:-1:a.keyCode===Blockly.utils.KeyCodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===Blockly.utils.KeyCodes.DOWN?b=-1:a.keyCode===Blockly.utils.KeyCodes.UP&&(b=1);b&&(this.setAngle(Number(this.getValue())+b*Blockly.FieldAngle.ROUND),a.preventDefault(),a.stopPropagation())}; -Blockly.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a)%360;if(isNaN(a))return null;0>a&&(a+=360);a>Blockly.FieldAngle.WRAP&&(a-=360);return a};Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b);this.size_.width=Blockly.FieldCheckbox.WIDTH};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked)};Blockly.FieldCheckbox.WIDTH=15;Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.CHECK_X_OFFSET=Blockly.Field.DEFAULT_TEXT_OFFSET-3; -Blockly.FieldCheckbox.CHECK_Y_OFFSET=14;Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default";Blockly.FieldCheckbox.prototype.isDirty_=!1; -Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this);this.textElement_.setAttribute("x",Blockly.FieldCheckbox.CHECK_X_OFFSET);this.textElement_.setAttribute("y",Blockly.FieldCheckbox.CHECK_Y_OFFSET);Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");var a=document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);this.textElement_.appendChild(a);this.textElement_.style.display=this.value_?"block":"none"}; -Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"}; -Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox);Blockly.utils.colour={};Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b,c):null}; +Blockly.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a)%360;if(isNaN(a))return null;0>a&&(a+=360);a>Blockly.FieldAngle.WRAP&&(a-=360);return a};Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b,c){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c);this.size_.width=Blockly.FieldCheckbox.WIDTH;this.checkChar_=null;this.configure_(c)};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,null,a)};Blockly.FieldCheckbox.WIDTH=15;Blockly.FieldCheckbox.CHECK_CHAR="\u2713"; +Blockly.FieldCheckbox.CHECK_X_OFFSET=Blockly.Field.DEFAULT_TEXT_OFFSET-3;Blockly.FieldCheckbox.CHECK_Y_OFFSET=14;Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default";Blockly.FieldCheckbox.prototype.isDirty_=!1;Blockly.FieldCheckbox.prototype.configure_=function(a){a&&a.checkCharacter&&(this.checkChar_=a.checkCharacter)}; +Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this);this.textElement_.setAttribute("x",Blockly.FieldCheckbox.CHECK_X_OFFSET);this.textElement_.setAttribute("y",Blockly.FieldCheckbox.CHECK_Y_OFFSET);Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");this.textContent_.nodeValue=this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR;this.textElement_.style.display=this.value_?"block":"none"}; +Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a;this.textContent_&&(this.textContent_.nodeValue=a||Blockly.FieldCheckbox.CHECK_CHAR)};Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null}; +Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))}; +Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox);Blockly.utils.colour={};Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b,c):null}; Blockly.utils.colour.rgbToHex=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};Blockly.utils.colour.hexToRgb=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))}; Blockly.utils.colour.blend=function(a,b,c){a=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(a));b=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(b));return Blockly.utils.colour.rgbToHex(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))}; -Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};Blockly.FieldColour=function(a,b,c){c&&(c.colourOptions&&this.setColours(c.colourOptions,c.colourTitles),c.columns&&this.setColumns(c.columns));a=this.doClassValidation_(a);null===a&&(a=Blockly.FieldColour.COLOURS[0]);Blockly.FieldColour.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,null,a)};Blockly.FieldColour.DEFAULT_WIDTH=26;Blockly.FieldColour.DEFAULT_HEIGHT=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT; -Blockly.FieldColour.prototype.SERIALIZABLE=!0;Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR="#dadce0";Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR="white"; +Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};Blockly.FieldColour=function(a,b,c){a=this.doClassValidation_(a);null===a&&(a=Blockly.FieldColour.COLOURS[0]);Blockly.FieldColour.superClass_.constructor.call(this,a,b,c);this.configure_(c)};goog.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,null,a)};Blockly.FieldColour.DEFAULT_WIDTH=26;Blockly.FieldColour.DEFAULT_HEIGHT=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT;Blockly.FieldColour.prototype.SERIALIZABLE=!0; +Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR="#dadce0";Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR="white";Blockly.FieldColour.prototype.configure_=function(a){a&&(a.colourOptions&&this.setColours(a.colourOptions,a.colourTitles),a.columns&&this.setColumns(a.columns))}; Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(Blockly.FieldColour.DEFAULT_WIDTH,Blockly.FieldColour.DEFAULT_HEIGHT);this.createBorderRect_();this.borderRect_.style.fillOpacity=1;this.borderRect_.style.fill=this.value_};Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)};Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a;this.borderRect_&&(this.borderRect_.style.fill=a)}; Blockly.FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "); Blockly.FieldColour.TITLES=[];Blockly.FieldColour.COLUMNS=7;Blockly.FieldColour.prototype.setColours=function(a,b){this.colours_=a;b&&(this.titles_=b);return this};Blockly.FieldColour.prototype.setColumns=function(a){this.columns_=a;return this}; @@ -989,31 +1020,33 @@ Blockly.FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||Bl Blockly.FieldColour.prototype.setHighlightedCell_=function(a,b){var c=this.getHighlighted_();c&&Blockly.utils.dom.removeClass(c,"blocklyColourHighlighted");Blockly.utils.dom.addClass(a,"blocklyColourHighlighted");this.highlightedIndex_=b;Blockly.utils.aria.setState(this.picker_,Blockly.utils.aria.State.ACTIVEDESCENDANT,a.getAttribute("id"))}; Blockly.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.colours_||Blockly.FieldColour.COLOURS,c=this.titles_||Blockly.FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable";e.tabIndex=0;Blockly.utils.aria.setRole(e,Blockly.utils.aria.Role.GRID);Blockly.utils.aria.setState(e,Blockly.utils.aria.State.EXPANDED,!0);Blockly.utils.aria.setState(e,"rowcount",Math.floor(b.length/a));Blockly.utils.aria.setState(e, "colcount",a);for(var f,g=Blockly.utils.IdGenerator.getInstance(),h=0;hd&&(a.height=d);this.sourceBlock_.RTL&&Blockly.utils.uiMenu.adjustBBoxesForRTL(b,c,a);Blockly.WidgetDiv.positionWithAnchor(b,c,a,this.sourceBlock_.RTL)}; Blockly.FieldDropdown.prototype.getAnchorDimensions_=function(){var a=this.getScaledBBox_();this.sourceBlock_.RTL?a.right+=Blockly.FieldDropdown.CHECKMARK_OVERHANG:a.left-=Blockly.FieldDropdown.CHECKMARK_OVERHANG;return a};Blockly.FieldDropdown.prototype.onItemSelected=function(a,b){this.setValue(b.getValue())}; Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var a=this.menuGenerator_;if(Array.isArray(a)){for(var b=!1,c=0;ca.length)){b=[];for(c=0;cthis.selectedIndex_)return null;var a=this.getOptions()[this.selectedIndex_][0];return"object"==typeof a?a.alt:a}; +Blockly.FieldDropdown.validateOptions_=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");for(var b=!1,c=0;c=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.imageHeight_=c;this.size_=new Blockly.utils.Size(b,c+Blockly.FieldImage.Y_PADDING);this.flipRtl_=f;this.text_=d||"";this.setValue(a||"");"function"==typeof e&& -(this.clickHandler_=e)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.src),c=Number(Blockly.utils.replaceMessageReferences(a.width)),d=Number(Blockly.utils.replaceMessageReferences(a.height)),e=Blockly.utils.replaceMessageReferences(a.alt);return new Blockly.FieldImage(b,c,d,e,null,!!a.flipRtl)};Blockly.FieldImage.Y_PADDING=1;Blockly.FieldImage.prototype.EDITABLE=!1;Blockly.FieldImage.prototype.isDirty_=!1; -Blockly.FieldImage.prototype.initView=function(){this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.text_},this.fieldGroup_);this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_)};Blockly.FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a}; -Blockly.FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_||"")};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setText=function(a){this.setAlt(a)};Blockly.FieldImage.prototype.setAlt=function(a){null!==a&&(this.text_=a,this.imageElement_&&this.imageElement_.setAttribute("alt",a||""))}; -Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.fieldRegistry.register("field_image",Blockly.FieldImage);Blockly.FieldNumber=function(a,b,c,d,e){this.setConstraints(b,c,d);a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldNumber.superClass_.constructor.call(this,a,e)};goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput);Blockly.FieldNumber.fromJson=function(a){return new Blockly.FieldNumber(a.value,a.min,a.max,a.precision)};Blockly.FieldNumber.prototype.SERIALIZABLE=!0; +Blockly.fieldRegistry.register("field_label_serializable",Blockly.FieldLabelSerializable);Blockly.FieldImage=function(a,b,c,d,e,f){this.sourceBlock_=null;if(!a)throw Error("Src value of an image field is required");if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");c=Number(c);b=Number(b);if(0>=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.imageHeight_=c;this.size_=new Blockly.utils.Size(b,c+Blockly.FieldImage.Y_PADDING);this.flipRtl_=f||!1;this.altText_=d||"";this.setValue(a||"");"function"== +typeof e&&(this.clickHandler_=e)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.src),c=Number(Blockly.utils.replaceMessageReferences(a.width)),d=Number(Blockly.utils.replaceMessageReferences(a.height)),e=Blockly.utils.replaceMessageReferences(a.alt);return new Blockly.FieldImage(b,c,d,e,null,!!a.flipRtl)};Blockly.FieldImage.Y_PADDING=1;Blockly.FieldImage.prototype.EDITABLE=!1; +Blockly.FieldImage.prototype.isDirty_=!1;Blockly.FieldImage.prototype.initView=function(){this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_);this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_)};Blockly.FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a}; +Blockly.FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_||"")};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setAlt=function(a){a!==this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))};Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)}; +Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.FieldImage.prototype.getText_=function(){return this.altText_};Blockly.fieldRegistry.register("field_image",Blockly.FieldImage);Blockly.FieldNumber=function(a,b,c,d,e){this.setConstraints(b,c,d);a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldNumber.superClass_.constructor.call(this,a,e)};goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput);Blockly.FieldNumber.fromJson=function(a){return new Blockly.FieldNumber(a.value,a.min,a.max,a.precision)};Blockly.FieldNumber.prototype.SERIALIZABLE=!0; Blockly.FieldNumber.prototype.setConstraints=function(a,b,c){c=Number(c);this.precision_=isNaN(c)?0:c;c=this.precision_.toString();var d=c.indexOf(".");this.fractionalDigits_=-1==d?-1:c.length-(d+1);a=Number(a);this.min_=isNaN(a)?-Infinity:a;b=Number(b);this.max_=isNaN(b)?Infinity:b;this.setValue(this.getValue())}; Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a||void 0===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.min_),this.max_);this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);return a=-1==this.fractionalDigits_?a:Number(a.toFixed(this.fractionalDigits_))}; Blockly.FieldNumber.prototype.widgetCreate_=function(){var a=Blockly.FieldNumber.superClass_.widgetCreate_.call(this);-Infinitythis.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_);return a};Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber);Blockly.FieldVariable=function(a,b,c,d){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.size_=new Blockly.utils.Size(0,Blockly.BlockSvg.MIN_BLOCK_Y);b&&this.setValidator(b);this.defaultVariableName=a||"";this.setTypes_(c,d);this.value_=null};goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,null,a.variableTypes,a.defaultType)}; @@ -1022,9 +1055,9 @@ Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a);this.workspace_=a.workspace}; Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""};Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_};Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null}; Blockly.FieldVariable.prototype.doClassValidation_=function(a){var b=Blockly.Variables.getVariable(this.workspace_,a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)}; -Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.workspace_,a);this.value_=a;this.text_=this.variable_.name;this.isDirty_=!0};Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {","stroke: #fc3;","stroke-width: 3px;", "}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {","stroke: #fc3;","}",".blocklyHtmlInput {", -"border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyTransparentBackground {","opacity: 0;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {", -"z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {", -"opacity: .8;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyAngleCircle {","stroke: #444;","stroke-width: 1;","fill: #ddd;","fill-opacity: .8;","}",".blocklyAngleMarks {","stroke: #444;","stroke-width: 1;","}",".blocklyAngleGauge {","fill: #f88;","fill-opacity: .8;","}",".blocklyAngleLine {", -"stroke: #f00;","stroke-width: 2;","stroke-linecap: round;","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {", -"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","}",".blocklyToolboxDiv {","background-color: #ddd;", -"overflow-x: visible;","overflow-y: auto;","position: absolute;","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;", -"}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);", -"height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;", -"}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyColourTable {","border-collapse: collapse;","outline: none;","padding: 1px;","display: block;", -"}",".blocklyColourTable>tr>td {","padding: 0;","cursor: pointer;","border: .5px solid transparent;","height: 25px;","width: 25px;","box-sizing: border-box;","display: inline-block;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","position: relative;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}",".blocklyWidgetDiv .goog-menu {", -"background: #fff;","border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;', -"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem, ",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem { ", -"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",".blocklyWidgetDiv .goog-menuitem-disabled, ",".blocklyDropDownDiv .goog-menuitem-disabled {", -"cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);", -"}",".blocklyWidgetDiv .goog-menuitem-highlight, ",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #f1f3f4;","}",".blocklyDropDownDiv .goog-menuitem-highlight, ",".blocklyDropDownDiv .goog-menuitem-hover {","background-color: rgba(0,0,0,.2);","}",".blocklyWidgetDiv .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;", -"position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon, ", -".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}",".blocklyWidgetDiv .goog-menuitem-accel, ", -".blocklyDropDownDiv .goog-menuitem-accel {","color: #999;","direction: ltr;","left: auto;","padding: 0 6px;","position: absolute;","right: 0;","text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-accel {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator, ", -".blocklyDropDownDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator, ",".blocklyDropDownDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;","}",""];Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=document.createElement("div"),Blockly.WidgetDiv.DIV.className="blocklyWidgetDiv",document.body.appendChild(Blockly.WidgetDiv.DIV))}; +"border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyTransparentBackground {","opacity: 0;","}",".blocklyMainWorkspaceScrollbar {", +"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {", +"opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyAngleCircle {","stroke: #444;","stroke-width: 1;","fill: #ddd;","fill-opacity: .8;","}",".blocklyAngleMarks {","stroke: #444;","stroke-width: 1;", +"}",".blocklyAngleGauge {","fill: #f88;","fill-opacity: .8;","}",".blocklyAngleLine {","stroke: #f00;","stroke-width: 2;","stroke-linecap: round;","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl, ", +".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<>>/sprites.png) no-repeat -48px -16px;", +"}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}", +".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;", +"margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;", +"}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyColourTable {", +"border-collapse: collapse;","outline: none;","padding: 1px;","display: block;","}",".blocklyColourTable>tr>td {","padding: 0;","cursor: pointer;","border: .5px solid transparent;","height: 25px;","width: 25px;","box-sizing: border-box;","display: inline-block;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","position: relative;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;", +"outline: 1px solid #333;","position: relative;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);", +"}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem, ",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem, ", +".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem { ","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {", +"color: #fff;","}",".blocklyWidgetDiv .goog-menuitem-disabled, ",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon, ", +".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight, ",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #f1f3f4;","}",".blocklyDropDownDiv .goog-menuitem-highlight, ",".blocklyDropDownDiv .goog-menuitem-hover {","background-color: rgba(0,0,0,.2);","}",".blocklyWidgetDiv .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-checkbox, ", +".blocklyDropDownDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox, ", +".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {", +"float: right;","margin-right: -24px;","}",".blocklyWidgetDiv .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-accel {","color: #999;","direction: ltr;","left: auto;","padding: 0 6px;","position: absolute;","right: 0;","text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-accel {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-hint {", +"text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator, ",".blocklyDropDownDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;","}",""];Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=document.createElement("div"),Blockly.WidgetDiv.DIV.className="blocklyWidgetDiv",document.body.appendChild(Blockly.WidgetDiv.DIV))}; Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;a=Blockly.utils.style.getViewportPageOffset();Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block"}; Blockly.WidgetDiv.hide=function(){Blockly.WidgetDiv.owner_&&(Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.DIV.style.display="none",Blockly.WidgetDiv.DIV.style.left="",Blockly.WidgetDiv.DIV.style.top="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,Blockly.WidgetDiv.DIV.innerHTML="")};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()}; Blockly.WidgetDiv.positionInternal_=function(a,b,c){Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c+"px"};Blockly.WidgetDiv.positionWithAnchor=function(a,b,c,d){var e=Blockly.WidgetDiv.calculateY_(a,b,c);a=Blockly.WidgetDiv.calculateX_(a,b,c,d);0>e?Blockly.WidgetDiv.positionInternal_(a,0,c.height+e):Blockly.WidgetDiv.positionInternal_(a,e,c.height)}; @@ -1274,10 +1312,10 @@ Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blo Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[],e=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,e,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,e,!0))}; Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.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(!(b.options.readOnly||Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible())){var c=!1;if(a.keyCode==Blockly.utils.KeyCodes.ESC)Blockly.hideChaff(),Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_EXIT);else{if(Blockly.keyboardAccessibilityMode&&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_, -a.isFlyout&&(a=a.targetWorkspace),Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)&&(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1))):a.keyCode==Blockly.utils.KeyCodes.Z&&(Blockly.hideChaff(),b.undo(a.shiftKey))}}c&&!Blockly.selected.workspace.isFlyout&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}}; -Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a,!0);Blockly.Xml.deleteNext(b);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace;Blockly.clipboardTypeCounts_=a.isComment?null:Blockly.utils.getBlockTypeCounts(a,!0)}; +Blockly.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))if(b.options.readOnly){if(Blockly.keyboardAccessibilityMode)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.keyboardAccessibilityMode&&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_,a.isFlyout&&(a=a.targetWorkspace),Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)&&(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1))):a.keyCode==Blockly.utils.KeyCodes.Z&&(Blockly.hideChaff(),b.undo(a.shiftKey))}}c&&!Blockly.selected.workspace.isFlyout&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0), +Blockly.Events.setGroup(!1))}};Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a,!0);Blockly.Xml.deleteNext(b);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace;Blockly.clipboardTypeCounts_=a.isComment?null:Blockly.utils.getBlockTypeCounts(a,!0)}; Blockly.duplicate_=function(a){var b=Blockly.clipboardXml_,c=Blockly.clipboardSource_;Blockly.copy_(a);a.workspace.paste(Blockly.clipboardXml_);Blockly.clipboardXml_=b;Blockly.clipboardSource_=c};Blockly.onContextMenu_=function(a){Blockly.utils.isTargetInput(a)||a.preventDefault()}; Blockly.hideChaff=function(a){Blockly.Tooltip.hide();Blockly.WidgetDiv.hide();Blockly.DropDownDiv.hideWithoutAnimation();var b=Blockly.getMainWorkspace();b.trashcan&&b.trashcan.flyout_&&b.trashcan.flyout_.hide();a||b.toolbox_&&b.toolbox_.flyout_&&b.toolbox_.flyout_.autoClose&&b.toolbox_.clearSelection()};Blockly.addChangeListener=function(a){console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead.");return Blockly.getMainWorkspace().addChangeListener(a)}; Blockly.getMainWorkspace=function(){return Blockly.mainWorkspace};Blockly.alert=function(a,b){alert(a);b&&b()};Blockly.confirm=function(a,b){b(confirm(a))};Blockly.prompt=function(a,b,c){c(prompt(a,b))};Blockly.jsonInitFactory_=function(a){return function(){this.jsonInit(a)}}; diff --git a/core/gesture.js b/core/gesture.js index dcace0ff4..d9ad6c8b4 100644 --- a/core/gesture.js +++ b/core/gesture.js @@ -500,7 +500,7 @@ Blockly.Gesture.prototype.doStart = function(e) { if (this.targetBlock_) { this.targetBlock_.select(); if (!this.targetBlock_.isInFlyout && e.shiftKey) { - Blockly.navigation.focusWorkspace(); + Blockly.navigation.enableKeyboardAccessibility(); } } @@ -760,15 +760,14 @@ Blockly.Gesture.prototype.doBlockClick_ = function() { * @private */ Blockly.Gesture.prototype.doWorkspaceClick_ = function(e) { - Blockly.keyboardAccessibilityMode = false; + Blockly.navigation.disableKeyboardAccessibility(); var ws = this.creatorWorkspace_; - ws.cursor.hide(); if (e.shiftKey) { + Blockly.navigation.enableKeyboardAccessibility(); var screenCoord = new Blockly.utils.Coordinate(e.clientX, e.clientY); var wsCoord = Blockly.utils.screenToWsCoordinates(ws, screenCoord); var wsNode = Blockly.ASTNode.createWorkspaceNode(ws, wsCoord); ws.cursor.setLocation(wsNode); - Blockly.keyboardAccessibilityMode = true; } else if (Blockly.selected) { Blockly.selected.unselect(); } diff --git a/core/keyboard_nav/cursor.js b/core/keyboard_nav/cursor.js index d54bb2a10..790e802c9 100644 --- a/core/keyboard_nav/cursor.js +++ b/core/keyboard_nav/cursor.js @@ -90,6 +90,12 @@ Blockly.Cursor.prototype.setLocation = function(newNode) { */ Blockly.Cursor.prototype.update_ = function() {}; +/** + * Hide method to be overwritten in cursor_svg. + * @protected + */ +Blockly.Cursor.prototype.hide = function() {}; + /** * Find the next connection, field, or block. * @return {Blockly.ASTNode} The next element, or null if the current node is diff --git a/core/keyboard_nav/navigation.js b/core/keyboard_nav/navigation.js index 1385bc38c..a236f0f6a 100644 --- a/core/keyboard_nav/navigation.js +++ b/core/keyboard_nav/navigation.js @@ -34,7 +34,7 @@ Blockly.navigation.cursor_ = null; /** * The marker that shows where a user has marked while navigating blocks. - * @type {!Blockly.CursorSvg} + * @type {!Blockly.Cursor} */ Blockly.navigation.marker_ = null; @@ -731,13 +731,15 @@ Blockly.navigation.disconnectBlocks = function() { Blockly.navigation.focusWorkspace = function() { var cursor = Blockly.navigation.cursor_; var reset = Blockly.getMainWorkspace().getToolbox() ? true : false; + var topBlocks = Blockly.getMainWorkspace().getTopBlocks(); Blockly.navigation.resetFlyout(reset); Blockly.navigation.currentState_ = Blockly.navigation.STATE_WS; - Blockly.navigation.enableKeyboardAccessibility(); if (Blockly.selected) { cursor.setLocation(Blockly.navigation.getTopNode_(Blockly.selected)); Blockly.selected.unselect(); + } else if (topBlocks.length > 0) { + cursor.setLocation(Blockly.navigation.getTopNode_(topBlocks[0])); } else { var ws = cursor.workspace_; // TODO: Find the center of the visible workspace. @@ -991,14 +993,20 @@ Blockly.navigation.toolboxOnAction_ = function(action) { * Enable accessibility mode. */ Blockly.navigation.enableKeyboardAccessibility = function() { - Blockly.keyboardAccessibilityMode = true; + if (!Blockly.keyboardAccessibilityMode) { + Blockly.keyboardAccessibilityMode = true; + Blockly.navigation.focusWorkspace(); + } }; /** * Disable accessibility mode. */ Blockly.navigation.disableKeyboardAccessibility = function() { - Blockly.keyboardAccessibilityMode = false; + if (Blockly.keyboardAccessibilityMode) { + Blockly.keyboardAccessibilityMode = false; + Blockly.navigation.cursor_.hide(); + } }; /** diff --git a/demos/keyboard_nav/index.html b/demos/keyboard_nav/index.html index a5783506b..571088d74 100644 --- a/demos/keyboard_nav/index.html +++ b/demos/keyboard_nav/index.html @@ -268,9 +268,6 @@ */ function preOrderDemo() { Blockly.navigation.enableKeyboardAccessibility(); - if (!Blockly.navigation.cursor_.getCurNode()) { - Blockly.navigation.focusWorkspace(); - } demo(); } @@ -282,18 +279,6 @@ */ function turnOnAccessibility() { Blockly.navigation.enableKeyboardAccessibility(); - var blocks = Blockly.getMainWorkspace().getTopBlocks(); - if (blocks.length > 0) { - var newNode; - if (blocks[0].previousConnection) { - newNode = Blockly.ASTNode.createConnectionNode(blocks[0].previousConnection); - } else { - newNode = Blockly.ASTNode.createBlockNode(blocks[0]); - } - Blockly.navigation.cursor_.setLocation(newNode); - } else { - Blockly.navigation.focusWorkspace(); - } } diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index 0b01a57e8..0860bd1c6 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -83,5 +83,16 @@ suite('Gesture', function() { flyout.autoClose = false; gestureIsFieldClick_InFlyoutHelper.call(this, flyout, true); }); - + + test('Workspace click - Shift click enters accessibility mode', function() { + var event = { + shiftKey : true, + + }; + var ws = Blockly.inject('blocklyDiv', {}); + var gesture = new Blockly.Gesture(this.e, ws); + assertFalse(Blockly.keyboardAccessibilityMode); + gesture.doWorkspaceClick_(event); + assertTrue(Blockly.keyboardAccessibilityMode); + }); }); diff --git a/tests/mocha/navigation_modify_test.js b/tests/mocha/navigation_modify_test.js index 4f6f25594..98f704e04 100644 --- a/tests/mocha/navigation_modify_test.js +++ b/tests/mocha/navigation_modify_test.js @@ -24,7 +24,6 @@ suite('Insert/Modify', function() { this.statement_block_2 = this.workspace.getBlockById('statement_block_2'); Blockly.navigation.enableKeyboardAccessibility(); - Blockly.navigation.focusWorkspace(); }); teardown(function() { diff --git a/tests/mocha/navigation_test.js b/tests/mocha/navigation_test.js index bead4fa50..6d3b61a22 100644 --- a/tests/mocha/navigation_test.js +++ b/tests/mocha/navigation_test.js @@ -221,7 +221,7 @@ suite('Navigation', function() { }]); var toolbox = document.getElementById('toolbox-categories'); this.workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox}); - Blockly.navigation.focusWorkspace(); + Blockly.navigation.enableKeyboardAccessibility(); this.basicBlock = this.workspace.newBlock('basic_block'); this.firstCategory_ = this.workspace.getToolbox().tree_.firstChild_; this.mockEvent = { @@ -633,10 +633,9 @@ suite('Navigation', function() { }]); var toolbox = document.getElementById('toolbox-categories'); this.workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox}); - Blockly.navigation.focusWorkspace(); + Blockly.navigation.enableKeyboardAccessibility(); this.basicBlockA = this.workspace.newBlock('basic_block'); this.basicBlockB = this.workspace.newBlock('basic_block'); - Blockly.keyboardAccessibilityMode = true; }); teardown(function() {