mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Recompile
This commit is contained in:
parent
afaafc1e5b
commit
cb29cef475
2 changed files with 12 additions and 12 deletions
|
@ -900,10 +900,10 @@ this.updateColour()):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=
|
|||
Blockly.Comment.prototype.setBubbleSize=function(a,b){this.textarea_?this.bubble_.setBubbleSize(a,b):(this.width_=a,this.height_=b)};Blockly.Comment.prototype.getText=function(){return this.textarea_?this.textarea_.value:this.text_};Blockly.Comment.prototype.setText=function(a){this.text_!=a&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,a)),this.text_=a);this.textarea_&&(this.textarea_.value=a)};
|
||||
Blockly.Comment.prototype.dispose=function(){Blockly.Events.isEnabled()&&this.setText("");this.block_.comment=null;Blockly.Icon.prototype.dispose.call(this)};Blockly.Connection=function(a,b){this.sourceBlock_=a;this.type=b;a.workspace.connectionDBList&&(this.db_=a.workspace.connectionDBList[b],this.dbOpposite_=a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],this.hidden_=!this.db_)};Blockly.Connection.BOOLEAN=1;Blockly.Connection.STRING=2;Blockly.Connection.NUMBER=3;Blockly.Connection.CAN_CONNECT=0;Blockly.Connection.REASON_SELF_CONNECTION=1;Blockly.Connection.REASON_WRONG_TYPE=2;Blockly.Connection.REASON_TARGET_NULL=3;
|
||||
Blockly.Connection.REASON_CHECKS_FAILED=4;Blockly.Connection.REASON_DIFFERENT_WORKSPACES=5;
|
||||
Blockly.Connection.connect_=function(a,b){var c=a.getSourceBlock(),d=b.getSourceBlock(),e=!1;a==c.getFirstStatementConnection()&&(e=!0);b.isConnected()&&b.disconnect();if(a.isConnected()){var f=a.targetBlock(),g=a.getShadowDom();a.setShadowDom(null);if(f.isShadow())g=Blockly.Xml.blockToDom(f),f.dispose(),f=null;else if(a.type==Blockly.INPUT_VALUE){if(!f.outputConnection)throw"Orphan block does not have an output connection.";var h=Blockly.Connection.lastConnectionInRow_(d,f);h&&(f.outputConnection.connect(h),
|
||||
f=null)}else if(a.type==Blockly.NEXT_STATEMENT){if(!f.previousConnection)throw"Orphan block does not have a previous connection.";for(h=d;h.nextConnection;)if(h.nextConnection.isConnected())h=h.getNextBlock();else{f.previousConnection.checkType_(h.nextConnection)&&(h.nextConnection.connect(f.previousConnection),f=null);break}}if(f&&(a.disconnect(),Blockly.Events.recordUndo)){var k=Blockly.Events.getGroup();setTimeout(function(){f.workspace&&!f.getParent()&&(Blockly.Events.setGroup(k),f.outputConnection?
|
||||
f.outputConnection.bumpAwayFrom_(a):f.previousConnection&&f.previousConnection.bumpAwayFrom_(a),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}a.setShadowDom(g)}e&&previousParentConnection&&previousParentConnection.connect(c.previousConnection);var l;Blockly.Events.isEnabled()&&(l=new Blockly.Events.Move(d));Blockly.Connection.connectReciprocally_(a,b);d.setParent(c);l&&(l.recordNew(),Blockly.Events.fire(l));c.rendered&&c.updateDisabled();d.rendered&&d.updateDisabled();c.rendered&&d.rendered&&
|
||||
(a.type==Blockly.NEXT_STATEMENT||a.type==Blockly.PREVIOUS_STATEMENT?d.render():c.render())};Blockly.Connection.prototype.targetConnection=null;Blockly.Connection.prototype.check_=null;Blockly.Connection.prototype.shadowDom_=null;Blockly.Connection.prototype.x_=0;Blockly.Connection.prototype.y_=0;Blockly.Connection.prototype.inDB_=!1;Blockly.Connection.prototype.db_=null;Blockly.Connection.prototype.dbOpposite_=null;Blockly.Connection.prototype.hidden_=null;
|
||||
Blockly.Connection.connect_=function(a,b){var c=a.getSourceBlock(),d=b.getSourceBlock(),e=!1;a==c.getFirstStatementConnection()&&(e=!0);if(b.isConnected()){if(e)var f=b.targetConnection;b.disconnect()}if(a.isConnected()){var g=a.targetBlock(),h=a.getShadowDom();a.setShadowDom(null);if(g.isShadow())h=Blockly.Xml.blockToDom(g),g.dispose(),g=null;else if(a.type==Blockly.INPUT_VALUE){if(!g.outputConnection)throw"Orphan block does not have an output connection.";var k=Blockly.Connection.lastConnectionInRow_(d,
|
||||
g);k&&(g.outputConnection.connect(k),g=null)}else if(a.type==Blockly.NEXT_STATEMENT){if(!g.previousConnection)throw"Orphan block does not have a previous connection.";for(k=d;k.nextConnection;)if(k.nextConnection.isConnected())k=k.getNextBlock();else{g.previousConnection.checkType_(k.nextConnection)&&(k.nextConnection.connect(g.previousConnection),g=null);break}}if(g&&(a.disconnect(),Blockly.Events.recordUndo)){var l=Blockly.Events.getGroup();setTimeout(function(){g.workspace&&!g.getParent()&&(Blockly.Events.setGroup(l),
|
||||
g.outputConnection?g.outputConnection.bumpAwayFrom_(a):g.previousConnection&&g.previousConnection.bumpAwayFrom_(a),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}a.setShadowDom(h)}e&&f&&f.connect(c.previousConnection);var n;Blockly.Events.isEnabled()&&(n=new Blockly.Events.Move(d));Blockly.Connection.connectReciprocally_(a,b);d.setParent(c);n&&(n.recordNew(),Blockly.Events.fire(n));c.rendered&&c.updateDisabled();d.rendered&&d.updateDisabled();c.rendered&&d.rendered&&(a.type==Blockly.NEXT_STATEMENT||
|
||||
a.type==Blockly.PREVIOUS_STATEMENT?d.render():c.render())};Blockly.Connection.prototype.targetConnection=null;Blockly.Connection.prototype.check_=null;Blockly.Connection.prototype.shadowDom_=null;Blockly.Connection.prototype.x_=0;Blockly.Connection.prototype.y_=0;Blockly.Connection.prototype.inDB_=!1;Blockly.Connection.prototype.db_=null;Blockly.Connection.prototype.dbOpposite_=null;Blockly.Connection.prototype.hidden_=null;
|
||||
Blockly.Connection.prototype.dispose=function(){if(this.isConnected())throw"Disconnect connection before disposing of it.";this.inDB_&&this.db_.removeConnection_(this);Blockly.highlightedConnection_==this&&(Blockly.highlightedConnection_=null);Blockly.localConnection_==this&&(Blockly.localConnection_=null);this.dbOpposite_=this.db_=null};Blockly.Connection.prototype.isConnectedToNonGhost=function(){return this.targetConnection&&!this.targetBlock().isGhost()};
|
||||
Blockly.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_};Blockly.Connection.prototype.isSuperior=function(){return this.type==Blockly.INPUT_VALUE||this.type==Blockly.NEXT_STATEMENT};Blockly.Connection.prototype.isConnected=function(){return!!this.targetConnection};Blockly.Connection.prototype.distanceFrom=function(a){var b=this.x_-a.x_;a=this.y_-a.y_;return Math.sqrt(b*b+a*a)};
|
||||
Blockly.Connection.prototype.canConnectWithReason_=function(a){if(a){if(this.sourceBlock_&&a.getSourceBlock()==this.sourceBlock_)return Blockly.Connection.REASON_SELF_CONNECTION;if(a.type!=Blockly.OPPOSITE_TYPE[this.type])return Blockly.Connection.REASON_WRONG_TYPE;if(this.sourceBlock_&&a.getSourceBlock()&&this.sourceBlock_.workspace!==a.getSourceBlock().workspace)return Blockly.Connection.REASON_DIFFERENT_WORKSPACES;if(!this.checkType_(a))return Blockly.Connection.REASON_CHECKS_FAILED}else return Blockly.Connection.REASON_TARGET_NULL;
|
||||
|
@ -1155,7 +1155,7 @@ Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.co
|
|||
Blockly.BlockSvg.prototype.setWarningText=function(a,b){this.setWarningText.pid_||(this.setWarningText.pid_=Object.create(null));var c=b||"";if(c)this.setWarningText.pid_[c]&&(clearTimeout(this.setWarningText.pid_[c]),delete this.setWarningText.pid_[c]);else for(var d in this.setWarningText.pid_)clearTimeout(this.setWarningText.pid_[d]),delete this.setWarningText.pid_[d];if(Blockly.dragMode_==Blockly.DRAG_FREE){var e=this;this.setWarningText.pid_[c]=setTimeout(function(){e.workspace&&(delete e.setWarningText.pid_[c],
|
||||
e.setWarningText(a,c))},100)}else{this.isInFlyout&&(a=null);d=!1;if(goog.isString(a))this.warning||(this.warning=new Blockly.Warning(this),d=!0),this.warning.setText(a,c);else if(this.warning&&!c)this.warning.dispose(),d=!0;else if(this.warning){d=this.warning.getText();this.warning.setText("",c);var f=this.warning.getText();f||this.warning.dispose();d=d==f}d&&this.rendered&&(this.render(),this.bumpNeighbours_())}};
|
||||
Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,a.createIcon())};Blockly.BlockSvg.prototype.addSelect=function(){Blockly.addClass_(this.svgGroup_,"blocklySelected");this.svgGroup_.parentNode.appendChild(this.svgGroup_)};Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.removeClass_(this.svgGroup_,"blocklySelected")};Blockly.BlockSvg.prototype.addDragging=function(){Blockly.addClass_(this.svgGroup_,"blocklyDragging")};
|
||||
Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")};Blockly.BlockSvg.prototype.setColour=function(a){Blockly.BlockSvg.superClass_.setColour.call(this,a);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")};Blockly.BlockSvg.prototype.setColour=function(a,b,c){Blockly.BlockSvg.superClass_.setColour.call(this,a,b,c);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.removeInput=function(a,b){Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.render={};Blockly.BlockSvg.GRID_UNIT=4;Blockly.BlockSvg.SEP_SPACE_X=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.SEP_SPACE_Y=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_BLOCK_SPACE=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;
|
||||
|
@ -1343,7 +1343,7 @@ Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDi
|
|||
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.DIV.style.height="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV),Blockly.Events.setGroup(!1))};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};
|
||||
Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=20;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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_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.Options=function(a){var b=!!a.readOnly;if(b)var c=null,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1;else c=Blockly.Options.parseToolboxTree_(a.toolbox),d=!(!c||!c.getElementsByTagName("category").length),e=a.trashcan,void 0===e&&(e=d),f=a.collapse,void 0===f&&(f=d),g=a.comments,void 0===g&&(g=d),h=a.disable,void 0===h&&(h=d),k=a.sounds,void 0===k&&(k=!0);var l=a.scrollbars;void 0===l&&(l=d);var n=a.css;void 0===n&&(n=!0);var m="https://blockly-demo.appspot.com/static/media/";a.media?m=a.media:a.path&&(m=
|
||||
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,t=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,r=!!a.realtime,u=r?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
|
||||
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,t=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,r=!!a.realtime,u=r?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
|
||||
c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=r;this.realtimeOptions=u;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=t};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
|
||||
Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:parseFloat(a.startScale);b.maxScale=void 0===a.maxScale?3:parseFloat(a.maxScale);b.minScale=void 0===a.minScale?.3:parseFloat(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:parseFloat(a.scaleSpeed);return b};
|
||||
Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=parseFloat(a.spacing)||0;b.colour=a.colour||"#888";b.length=parseFloat(a.length)||1;b.snap=0<b.spacing&&!!a.snap;return b};Blockly.Options.parseToolboxTree_=function(a){a?("string"!=typeof a&&("undefined"==typeof XSLTProcessor&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=Blockly.Xml.textToDom(a))):a=null;return a};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=Blockly.createDom_(a,c),c=Blockly.createMainWorkspace_(d,c);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(d,"focus",c,c.markFocused);return c};
|
||||
|
|
|
@ -900,10 +900,10 @@ this.updateColour()):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=
|
|||
Blockly.Comment.prototype.setBubbleSize=function(a,b){this.textarea_?this.bubble_.setBubbleSize(a,b):(this.width_=a,this.height_=b)};Blockly.Comment.prototype.getText=function(){return this.textarea_?this.textarea_.value:this.text_};Blockly.Comment.prototype.setText=function(a){this.text_!=a&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,a)),this.text_=a);this.textarea_&&(this.textarea_.value=a)};
|
||||
Blockly.Comment.prototype.dispose=function(){Blockly.Events.isEnabled()&&this.setText("");this.block_.comment=null;Blockly.Icon.prototype.dispose.call(this)};Blockly.Connection=function(a,b){this.sourceBlock_=a;this.type=b;a.workspace.connectionDBList&&(this.db_=a.workspace.connectionDBList[b],this.dbOpposite_=a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],this.hidden_=!this.db_)};Blockly.Connection.BOOLEAN=1;Blockly.Connection.STRING=2;Blockly.Connection.NUMBER=3;Blockly.Connection.CAN_CONNECT=0;Blockly.Connection.REASON_SELF_CONNECTION=1;Blockly.Connection.REASON_WRONG_TYPE=2;Blockly.Connection.REASON_TARGET_NULL=3;
|
||||
Blockly.Connection.REASON_CHECKS_FAILED=4;Blockly.Connection.REASON_DIFFERENT_WORKSPACES=5;
|
||||
Blockly.Connection.connect_=function(a,b){var c=a.getSourceBlock(),d=b.getSourceBlock(),e=!1;a==c.getFirstStatementConnection()&&(e=!0);b.isConnected()&&b.disconnect();if(a.isConnected()){var f=a.targetBlock(),g=a.getShadowDom();a.setShadowDom(null);if(f.isShadow())g=Blockly.Xml.blockToDom(f),f.dispose(),f=null;else if(a.type==Blockly.INPUT_VALUE){if(!f.outputConnection)throw"Orphan block does not have an output connection.";var h=Blockly.Connection.lastConnectionInRow_(d,f);h&&(f.outputConnection.connect(h),
|
||||
f=null)}else if(a.type==Blockly.NEXT_STATEMENT){if(!f.previousConnection)throw"Orphan block does not have a previous connection.";for(h=d;h.nextConnection;)if(h.nextConnection.isConnected())h=h.getNextBlock();else{f.previousConnection.checkType_(h.nextConnection)&&(h.nextConnection.connect(f.previousConnection),f=null);break}}if(f&&(a.disconnect(),Blockly.Events.recordUndo)){var k=Blockly.Events.getGroup();setTimeout(function(){f.workspace&&!f.getParent()&&(Blockly.Events.setGroup(k),f.outputConnection?
|
||||
f.outputConnection.bumpAwayFrom_(a):f.previousConnection&&f.previousConnection.bumpAwayFrom_(a),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}a.setShadowDom(g)}e&&previousParentConnection&&previousParentConnection.connect(c.previousConnection);var m;Blockly.Events.isEnabled()&&(m=new Blockly.Events.Move(d));Blockly.Connection.connectReciprocally_(a,b);d.setParent(c);m&&(m.recordNew(),Blockly.Events.fire(m));c.rendered&&c.updateDisabled();d.rendered&&d.updateDisabled();c.rendered&&d.rendered&&
|
||||
(a.type==Blockly.NEXT_STATEMENT||a.type==Blockly.PREVIOUS_STATEMENT?d.render():c.render())};Blockly.Connection.prototype.targetConnection=null;Blockly.Connection.prototype.check_=null;Blockly.Connection.prototype.shadowDom_=null;Blockly.Connection.prototype.x_=0;Blockly.Connection.prototype.y_=0;Blockly.Connection.prototype.inDB_=!1;Blockly.Connection.prototype.db_=null;Blockly.Connection.prototype.dbOpposite_=null;Blockly.Connection.prototype.hidden_=null;
|
||||
Blockly.Connection.connect_=function(a,b){var c=a.getSourceBlock(),d=b.getSourceBlock(),e=!1;a==c.getFirstStatementConnection()&&(e=!0);if(b.isConnected()){if(e)var f=b.targetConnection;b.disconnect()}if(a.isConnected()){var g=a.targetBlock(),h=a.getShadowDom();a.setShadowDom(null);if(g.isShadow())h=Blockly.Xml.blockToDom(g),g.dispose(),g=null;else if(a.type==Blockly.INPUT_VALUE){if(!g.outputConnection)throw"Orphan block does not have an output connection.";var k=Blockly.Connection.lastConnectionInRow_(d,
|
||||
g);k&&(g.outputConnection.connect(k),g=null)}else if(a.type==Blockly.NEXT_STATEMENT){if(!g.previousConnection)throw"Orphan block does not have a previous connection.";for(k=d;k.nextConnection;)if(k.nextConnection.isConnected())k=k.getNextBlock();else{g.previousConnection.checkType_(k.nextConnection)&&(k.nextConnection.connect(g.previousConnection),g=null);break}}if(g&&(a.disconnect(),Blockly.Events.recordUndo)){var m=Blockly.Events.getGroup();setTimeout(function(){g.workspace&&!g.getParent()&&(Blockly.Events.setGroup(m),
|
||||
g.outputConnection?g.outputConnection.bumpAwayFrom_(a):g.previousConnection&&g.previousConnection.bumpAwayFrom_(a),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}a.setShadowDom(h)}e&&f&&f.connect(c.previousConnection);var n;Blockly.Events.isEnabled()&&(n=new Blockly.Events.Move(d));Blockly.Connection.connectReciprocally_(a,b);d.setParent(c);n&&(n.recordNew(),Blockly.Events.fire(n));c.rendered&&c.updateDisabled();d.rendered&&d.updateDisabled();c.rendered&&d.rendered&&(a.type==Blockly.NEXT_STATEMENT||
|
||||
a.type==Blockly.PREVIOUS_STATEMENT?d.render():c.render())};Blockly.Connection.prototype.targetConnection=null;Blockly.Connection.prototype.check_=null;Blockly.Connection.prototype.shadowDom_=null;Blockly.Connection.prototype.x_=0;Blockly.Connection.prototype.y_=0;Blockly.Connection.prototype.inDB_=!1;Blockly.Connection.prototype.db_=null;Blockly.Connection.prototype.dbOpposite_=null;Blockly.Connection.prototype.hidden_=null;
|
||||
Blockly.Connection.prototype.dispose=function(){if(this.isConnected())throw"Disconnect connection before disposing of it.";this.inDB_&&this.db_.removeConnection_(this);Blockly.highlightedConnection_==this&&(Blockly.highlightedConnection_=null);Blockly.localConnection_==this&&(Blockly.localConnection_=null);this.dbOpposite_=this.db_=null};Blockly.Connection.prototype.isConnectedToNonGhost=function(){return this.targetConnection&&!this.targetBlock().isGhost()};
|
||||
Blockly.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_};Blockly.Connection.prototype.isSuperior=function(){return this.type==Blockly.INPUT_VALUE||this.type==Blockly.NEXT_STATEMENT};Blockly.Connection.prototype.isConnected=function(){return!!this.targetConnection};Blockly.Connection.prototype.distanceFrom=function(a){var b=this.x_-a.x_;a=this.y_-a.y_;return Math.sqrt(b*b+a*a)};
|
||||
Blockly.Connection.prototype.canConnectWithReason_=function(a){if(a){if(this.sourceBlock_&&a.getSourceBlock()==this.sourceBlock_)return Blockly.Connection.REASON_SELF_CONNECTION;if(a.type!=Blockly.OPPOSITE_TYPE[this.type])return Blockly.Connection.REASON_WRONG_TYPE;if(this.sourceBlock_&&a.getSourceBlock()&&this.sourceBlock_.workspace!==a.getSourceBlock().workspace)return Blockly.Connection.REASON_DIFFERENT_WORKSPACES;if(!this.checkType_(a))return Blockly.Connection.REASON_CHECKS_FAILED}else return Blockly.Connection.REASON_TARGET_NULL;
|
||||
|
@ -1155,7 +1155,7 @@ Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.co
|
|||
Blockly.BlockSvg.prototype.setWarningText=function(a,b){this.setWarningText.pid_||(this.setWarningText.pid_=Object.create(null));var c=b||"";if(c)this.setWarningText.pid_[c]&&(clearTimeout(this.setWarningText.pid_[c]),delete this.setWarningText.pid_[c]);else for(var d in this.setWarningText.pid_)clearTimeout(this.setWarningText.pid_[d]),delete this.setWarningText.pid_[d];if(Blockly.dragMode_==Blockly.DRAG_FREE){var e=this;this.setWarningText.pid_[c]=setTimeout(function(){e.workspace&&(delete e.setWarningText.pid_[c],
|
||||
e.setWarningText(a,c))},100)}else{this.isInFlyout&&(a=null);d=!1;if(goog.isString(a))this.warning||(this.warning=new Blockly.Warning(this),d=!0),this.warning.setText(a,c);else if(this.warning&&!c)this.warning.dispose(),d=!0;else if(this.warning){d=this.warning.getText();this.warning.setText("",c);var f=this.warning.getText();f||this.warning.dispose();d=d==f}d&&this.rendered&&(this.render(),this.bumpNeighbours_())}};
|
||||
Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,a.createIcon())};Blockly.BlockSvg.prototype.addSelect=function(){Blockly.addClass_(this.svgGroup_,"blocklySelected");this.svgGroup_.parentNode.appendChild(this.svgGroup_)};Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.removeClass_(this.svgGroup_,"blocklySelected")};Blockly.BlockSvg.prototype.addDragging=function(){Blockly.addClass_(this.svgGroup_,"blocklyDragging")};
|
||||
Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")};Blockly.BlockSvg.prototype.setColour=function(a){Blockly.BlockSvg.superClass_.setColour.call(this,a);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")};Blockly.BlockSvg.prototype.setColour=function(a,b,c){Blockly.BlockSvg.superClass_.setColour.call(this,a,b,c);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.removeInput=function(a,b){Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.render={};Blockly.BlockSvg.SEP_SPACE_X=10;Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.INLINE_PADDING_Y=5;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_HEIGHT=20;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.NOTCH_WIDTH=30;Blockly.BlockSvg.CORNER_RADIUS=4;Blockly.BlockSvg.START_HAT=!0;Blockly.BlockSvg.START_HAT_PATH="c 30,-15 70,-15 100,0";Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4";Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4";
|
||||
|
@ -1348,7 +1348,7 @@ Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDi
|
|||
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.DIV.style.height="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV),Blockly.Events.setGroup(!1))};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};
|
||||
Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=20;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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_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.Options=function(a){var b=!!a.readOnly;if(b)var c=null,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1;else c=Blockly.Options.parseToolboxTree_(a.toolbox),d=!(!c||!c.getElementsByTagName("category").length),e=a.trashcan,void 0===e&&(e=d),f=a.collapse,void 0===f&&(f=d),g=a.comments,void 0===g&&(g=d),h=a.disable,void 0===h&&(h=d),k=a.sounds,void 0===k&&(k=!0);var m=a.scrollbars;void 0===m&&(m=d);var n=a.css;void 0===n&&(n=!0);var l="https://blockly-demo.appspot.com/static/media/";a.media?l=a.media:a.path&&(l=
|
||||
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,r=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,t=!!a.realtime,u=t?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=l;this.hasCategories=d;this.hasScrollbars=m;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
|
||||
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,r=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,t=!!a.realtime,u=t?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=l;this.hasCategories=d;this.hasScrollbars=m;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
|
||||
c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=t;this.realtimeOptions=u;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=r};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
|
||||
Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:parseFloat(a.startScale);b.maxScale=void 0===a.maxScale?3:parseFloat(a.maxScale);b.minScale=void 0===a.minScale?.3:parseFloat(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:parseFloat(a.scaleSpeed);return b};
|
||||
Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=parseFloat(a.spacing)||0;b.colour=a.colour||"#888";b.length=parseFloat(a.length)||1;b.snap=0<b.spacing&&!!a.snap;return b};Blockly.Options.parseToolboxTree_=function(a){a?("string"!=typeof a&&("undefined"==typeof XSLTProcessor&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=Blockly.Xml.textToDom(a))):a=null;return a};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=Blockly.createDom_(a,c),c=Blockly.createMainWorkspace_(d,c);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(d,"focus",c,c.markFocused);return c};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue