Update: 更新Blockly
This commit is contained in:
@@ -955,7 +955,7 @@ b.getParent()||($.setGroup$$module$build$src$core$events$utils(c),this.bumpAwayF
|
|||||||
f.updateDisabled();f.queueRender();f.getSvgRoot().style.display="block";$.setGroup$$module$build$src$core$events$utils(d)}}respawnShadow_(){super.respawnShadow_();const a=this.targetBlock();a&&(a.initSvg(),a.queueRender())}neighbours(a){return this.dbOpposite.getNeighbours(this,a)}connect_(a){super.connect_(a);var b=this.getSourceBlock();a=a.getSourceBlock();b.updateDisabled();a.updateDisabled();a.queueRender();if(b=b.getInputWithBlock(a))b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none"}onCheckChanged_(){!this.isConnected()||
|
f.updateDisabled();f.queueRender();f.getSvgRoot().style.display="block";$.setGroup$$module$build$src$core$events$utils(d)}}respawnShadow_(){super.respawnShadow_();const a=this.targetBlock();a&&(a.initSvg(),a.queueRender())}neighbours(a){return this.dbOpposite.getNeighbours(this,a)}connect_(a){super.connect_(a);var b=this.getSourceBlock();a=a.getSourceBlock();b.updateDisabled();a.updateDisabled();a.queueRender();if(b=b.getInputWithBlock(a))b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none"}onCheckChanged_(){!this.isConnected()||
|
||||||
this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(a){super.setCheck(a);this.sourceBlock_.queueRender();return this}};
|
this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(a){super.setCheck(a);this.sourceBlock_.queueRender();return this}};
|
||||||
(function(a){a=a.TrackedState||(a.TrackedState={});a[a.WILL_TRACK=-1]="WILL_TRACK";a[a.UNTRACKED=0]="UNTRACKED";a[a.TRACKED=1]="TRACKED"})(RenderedConnection$$module$build$src$core$rendered_connection||(RenderedConnection$$module$build$src$core$rendered_connection={}));var TrackedState$$module$build$src$core$rendered_connection=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState,module$build$src$core$rendered_connection={};
|
(function(a){a=a.TrackedState||(a.TrackedState={});a[a.WILL_TRACK=-1]="WILL_TRACK";a[a.UNTRACKED=0]="UNTRACKED";a[a.TRACKED=1]="TRACKED"})(RenderedConnection$$module$build$src$core$rendered_connection||(RenderedConnection$$module$build$src$core$rendered_connection={}));var TrackedState$$module$build$src$core$rendered_connection=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState,module$build$src$core$rendered_connection={};
|
||||||
module$build$src$core$rendered_connection.RenderedConnection=RenderedConnection$$module$build$src$core$rendered_connection;module$build$src$core$rendered_connection.TrackedState=TrackedState$$module$build$src$core$rendered_connection;var BlockSvg$$module$build$src$core$block_svg=class extends Block$$module$build$src$core$block{constructor(a,b,c){super(a,b,c);this.childlessWidth=this.width=this.height=0;this.warningTextDb=new Map;this.mutator=null;this.rendered=!0;this.eventsInit_=this.renderIsInProgress_=this.visuallyDisabled=!1;this.translation="";this.dragging=!1;this.relativeCoords=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.dragStrategy=new BlockDragStrategy$$module$build$src$core$dragging$block_drag_strategy(this);
|
module$build$src$core$rendered_connection.RenderedConnection=RenderedConnection$$module$build$src$core$rendered_connection;module$build$src$core$rendered_connection.TrackedState=TrackedState$$module$build$src$core$rendered_connection;var BlockSvg$$module$build$src$core$block_svg=class extends Block$$module$build$src$core$block{constructor(a,b,c){super(a,b,c);this.childlessWidth=this.width=this.height=0;this.warningTextDb=new Map;this.mutator=null;this.rendered=!0;this.eventsInit_=this.renderIsInProgress_=this.visuallyDisabled=!1;this.translation="";this.bumpNeighboursPid=0;this.dragging=!1;this.relativeCoords=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.dragStrategy=new BlockDragStrategy$$module$build$src$core$dragging$block_drag_strategy(this);
|
||||||
if(!a.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=a;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{});this.style=a.getRenderer().getConstants().getBlockStyle(null);this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style);a=this.pathObject.svgPath;a.tooltip=this;bindMouseEvents$$module$build$src$core$tooltip(a);this.svgGroup_.setAttribute("data-id",this.id);this.doInit_()}initSvg(){if(!this.initialized){for(var a of this.inputList)a.init();
|
if(!a.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=a;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{});this.style=a.getRenderer().getConstants().getBlockStyle(null);this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style);a=this.pathObject.svgPath;a.tooltip=this;bindMouseEvents$$module$build$src$core$tooltip(a);this.svgGroup_.setAttribute("data-id",this.id);this.doInit_()}initSvg(){if(!this.initialized){for(var a of this.inputList)a.init();
|
||||||
for(const b of this.getIcons())b.initView(this.createIconPointerDownListener(b)),b.updateEditable();this.applyColour();this.pathObject.updateMovable(this.isMovable()||this.isInFlyout);a=this.getSvgRoot();!this.workspace.options.readOnly&&a&&conditionalBind$$module$build$src$core$browser_events(a,"pointerdown",this,this.onMouseDown_);a.parentNode||this.workspace.getCanvas().appendChild(a);this.initialized=!0}}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()){let a;
|
for(const b of this.getIcons())b.initView(this.createIconPointerDownListener(b)),b.updateEditable();this.applyColour();this.pathObject.updateMovable(this.isMovable()||this.isInFlyout);a=this.getSvgRoot();!this.workspace.options.readOnly&&a&&conditionalBind$$module$build$src$core$browser_events(a,"pointerdown",this,this.onMouseDown_);a.parentNode||this.workspace.getCanvas().appendChild(a);this.initialized=!0}}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()){let a;
|
||||||
null==(a=this.getParent())||a.select()}else this.addSelect()}unselect(){if(this.isShadow()){let a;null==(a=this.getParent())||a.unselect()}else this.removeSelect()}setParent(a){const b=this.parentBlock_;if(a!==b){startTextWidthCache$$module$build$src$core$utils$dom();super.setParent(a);stopTextWidthCache$$module$build$src$core$utils$dom();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?a.getSvgRoot().appendChild(c):b&&((a=this.workspace.getCanvas().querySelector(".blocklyDragging"))?
|
null==(a=this.getParent())||a.select()}else this.addSelect()}unselect(){if(this.isShadow()){let a;null==(a=this.getParent())||a.unselect()}else this.removeSelect()}setParent(a){const b=this.parentBlock_;if(a!==b){startTextWidthCache$$module$build$src$core$utils$dom();super.setParent(a);stopTextWidthCache$$module$build$src$core$utils$dom();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?a.getSvgRoot().appendChild(c):b&&((a=this.workspace.getCanvas().querySelector(".blocklyDragging"))?
|
||||||
@@ -980,13 +980,14 @@ b||this.getInheritedDisabled()||this.updateDisabled()}setDisabledReason(a,b){con
|
|||||||
this.pathObject.setStyle(a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()}setStyle(a){const b=this.workspace.getRenderer().getConstants().getBlockStyle(a);this.styleName_=a;if(b)this.hat=b.hat,this.pathObject.setStyle(b),this.colour_=b.colourPrimary,this.style=b,this.applyColour();else throw Error("Invalid style name: "+a);}bringToFront(a=!1){let b=this;if(!b.isDeadOrDying()){do{const c=b.getSvgRoot(),d=c.parentNode,e=d.childNodes;e[e.length-1]!==c&&d.appendChild(c);if(a)break;
|
this.pathObject.setStyle(a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()}setStyle(a){const b=this.workspace.getRenderer().getConstants().getBlockStyle(a);this.styleName_=a;if(b)this.hat=b.hat,this.pathObject.setStyle(b),this.colour_=b.colourPrimary,this.style=b,this.applyColour();else throw Error("Invalid style name: "+a);}bringToFront(a=!1){let b=this;if(!b.isDeadOrDying()){do{const c=b.getSvgRoot(),d=c.parentNode,e=d.childNodes;e[e.length-1]!==c&&d.appendChild(c);if(a)break;
|
||||||
b=b.getParent()}while(b)}}setPreviousStatement(a,b){super.setPreviousStatement(a,b);this.queueRender()}setNextStatement(a,b){super.setNextStatement(a,b);this.queueRender()}setOutput(a,b){super.setOutput(a,b);this.queueRender()}setInputsInline(a){super.setInputsInline(a);this.queueRender()}removeInput(a,b){a=super.removeInput(a,b);this.queueRender();return a}moveNumberedInputBefore(a,b){super.moveNumberedInputBefore(a,b);this.queueRender()}appendInput(a){super.appendInput(a);this.queueRender();return a}setConnectionTracking(a){this.previousConnection&&
|
b=b.getParent()}while(b)}}setPreviousStatement(a,b){super.setPreviousStatement(a,b);this.queueRender()}setNextStatement(a,b){super.setNextStatement(a,b);this.queueRender()}setOutput(a,b){super.setOutput(a,b);this.queueRender()}setInputsInline(a){super.setInputsInline(a);this.queueRender()}removeInput(a,b){a=super.removeInput(a,b);this.queueRender();return a}moveNumberedInputBefore(a,b){super.moveNumberedInputBefore(a,b);this.queueRender()}appendInput(a){super.appendInput(a);this.queueRender();return a}setConnectionTracking(a){this.previousConnection&&
|
||||||
this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}}getConnections_(a){const b=[];this.outputConnection&&b.push(this.outputConnection);this.previousConnection&&b.push(this.previousConnection);
|
this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}}getConnections_(a){const b=[];this.outputConnection&&b.push(this.outputConnection);this.previousConnection&&b.push(this.previousConnection);
|
||||||
this.nextConnection&&b.push(this.nextConnection);if(a||!this.collapsed_)for(let c=0,d;d=this.inputList[c];c++)d.connection&&b.push(d.connection);return b}lastConnectionInStack(a){return super.lastConnectionInStack(a)}getMatchingConnection(a,b){return super.getMatchingConnection(a,b)}makeConnection_(a){return new RenderedConnection$$module$build$src$core$rendered_connection(this,a)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){const a=
|
this.nextConnection&&b.push(this.nextConnection);if(a||!this.collapsed_)for(let c=0,d;d=this.inputList[c];c++)d.connection&&b.push(d.connection);return b}lastConnectionInStack(a){return super.lastConnectionInStack(a)}getMatchingConnection(a,b){return super.getMatchingConnection(a,b)}makeConnection_(a){return new RenderedConnection$$module$build$src$core$rendered_connection(this,a)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){if(!this.bumpNeighboursPid){var a=
|
||||||
this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||a.isInFlyout))for(const b of this.getConnections_(!1)){if(b.isSuperior()){let c;null==(c=b.targetBlock())||c.bumpNeighbours()}for(const c of b.neighbours($.config$$module$build$src$core$config.snapRadius))c.getSourceBlock().getRootBlock()!==a&&(b.isConnected()&&c.isConnected()||(b.isSuperior()?c.bumpAwayFrom(b):b.bumpAwayFrom(c)))}}scheduleSnapAndBump(){this.snapToGrid();this.bumpNeighbours()}positionNearConnection(a,b,c){if(a.type===
|
$.getGroup$$module$build$src$core$events$utils();this.bumpNeighboursPid=setTimeout(()=>{const b=$.getGroup$$module$build$src$core$events$utils();$.setGroup$$module$build$src$core$events$utils(a);this.getRootBlock().bumpNeighboursInternal();$.setGroup$$module$build$src$core$events$utils(b);this.bumpNeighboursPid=0},$.config$$module$build$src$core$config.bumpDelay)}}bumpNeighboursInternal(){const a=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||a.isInFlyout))for(const b of this.getConnections_(!1)){if(b.isSuperior()){let c;
|
||||||
ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT||a.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE){let d=b.x;b=b.y;d+=c.x-a.getOffsetInBlock().x;b+=c.y-a.getOffsetInBlock().y;this.moveBy(d,b)}}getChildren(a){return super.getChildren(a)}queueRender(){return queueRender$$module$build$src$core$render_management(this)}render(){this.queueRender();triggerQueuedRenders$$module$build$src$core$render_management()}renderEfficiently(){startTextWidthCache$$module$build$src$core$utils$dom();
|
null==(c=b.targetBlock())||c.bumpNeighboursInternal()}for(const c of b.neighbours($.config$$module$build$src$core$config.snapRadius))c.getSourceBlock().getRootBlock()!==a&&(b.isConnected()&&c.isConnected()||(b.isSuperior()?c.bumpAwayFrom(b):b.bumpAwayFrom(c)))}}scheduleSnapAndBump(){this.snapToGrid();this.bumpNeighbours()}positionNearConnection(a,b,c){if(a.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT||a.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE){let d=
|
||||||
this.isCollapsed()&&this.updateCollapsed_();this.isEnabled()||this.updateDisabled();this.workspace.getRenderer().render(this);this.tightenChildrenEfficiently();stopTextWidthCache$$module$build$src$core$utils$dom();this.updateMarkers_()}tightenChildrenEfficiently(){for(const a of this.inputList){const b=a.connection;b&&b.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw();
|
b.x;b=b.y;d+=c.x-a.getOffsetInBlock().x;b+=c.y-a.getOffsetInBlock().y;this.moveBy(d,b)}}getChildren(a){return super.getChildren(a)}queueRender(){return queueRender$$module$build$src$core$render_management(this)}render(){this.queueRender();triggerQueuedRenders$$module$build$src$core$render_management()}renderEfficiently(){startTextWidthCache$$module$build$src$core$utils$dom();this.isCollapsed()&&this.updateCollapsed_();this.isEnabled()||this.updateDisabled();this.workspace.getRenderer().render(this);
|
||||||
this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw();for(const a of this.inputList)for(const b of a.fieldRow)b.updateMarkers_()}setCursorSvg(a){this.pathObject.setCursorSvg(a)}setMarkerSvg(a){this.pathObject.setMarkerSvg(a)}getHeightWidth(){let a=this.height,b=this.width;var c=this.getNextBlock();if(c){c=c.getHeightWidth();const d=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;
|
this.tightenChildrenEfficiently();stopTextWidthCache$$module$build$src$core$utils$dom();this.updateMarkers_()}tightenChildrenEfficiently(){for(const a of this.inputList){const b=a.connection;b&&b.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw();this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw();
|
||||||
a+=c.height-d;b=Math.max(b,c.width)}return{height:a,width:b}}fadeForReplacement(a){this.pathObject.updateReplacementFade(a)}highlightShapeForInput(a,b){this.pathObject.updateShapeForInputHighlight(a,b)}setDragStrategy(a){this.dragStrategy=a}isMovable(){return this.dragStrategy.isMovable()}startDrag(a){this.dragStrategy.startDrag(a)}drag(a,b){this.dragStrategy.drag(a,b)}endDrag(a){this.dragStrategy.endDrag(a)}revertDrag(){this.dragStrategy.revertDrag()}toFlyoutInfo(){const a=Object.assign({},{kind:"BLOCK"},
|
for(const a of this.inputList)for(const b of a.fieldRow)b.updateMarkers_()}setCursorSvg(a){this.pathObject.setCursorSvg(a)}setMarkerSvg(a){this.pathObject.setMarkerSvg(a)}getHeightWidth(){let a=this.height,b=this.width;var c=this.getNextBlock();if(c){c=c.getHeightWidth();const d=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;a+=c.height-d;b=Math.max(b,c.width)}return{height:a,width:b}}fadeForReplacement(a){this.pathObject.updateReplacementFade(a)}highlightShapeForInput(a,b){this.pathObject.updateShapeForInputHighlight(a,
|
||||||
save$$module$build$src$core$serialization$blocks(this)),b=new Set(["id","height","width","pinned","enabled"]),c=function(d){for(const e in d)b.has(e)?delete d[e]:"object"===typeof d[e]&&c(d[e])};c(a);return[a]}};BlockSvg$$module$build$src$core$block_svg.INLINE=-1;BlockSvg$$module$build$src$core$block_svg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var module$build$src$core$block_svg={};module$build$src$core$block_svg.BlockSvg=BlockSvg$$module$build$src$core$block_svg;var DragTarget$$module$build$src$core$drag_target=class{constructor(){}onDragEnter(a){}onDragOver(a){}onDragExit(a){}onDrop(a){}getClientRect(){return null}shouldPreventMove(a){return!1}},module$build$src$core$drag_target={};module$build$src$core$drag_target.DragTarget=DragTarget$$module$build$src$core$drag_target;var module$build$src$core$interfaces$i_deletable={};module$build$src$core$interfaces$i_deletable.isDeletable=isDeletable$$module$build$src$core$interfaces$i_deletable;var DeleteArea$$module$build$src$core$delete_area=class extends DragTarget$$module$build$src$core$drag_target{constructor(){super();this.wouldDelete_=!1}wouldDelete(a){a instanceof BlockSvg$$module$build$src$core$block_svg?(a=!a.getParent()&&a.isDeletable(),this.updateWouldDelete_(a)):this.updateWouldDelete_(isDeletable$$module$build$src$core$interfaces$i_deletable(a)&&a.isDeletable());return this.wouldDelete_}updateWouldDelete_(a){this.wouldDelete_=a}},module$build$src$core$delete_area={};
|
b)}setDragStrategy(a){this.dragStrategy=a}isMovable(){return this.dragStrategy.isMovable()}startDrag(a){this.dragStrategy.startDrag(a)}drag(a,b){this.dragStrategy.drag(a,b)}endDrag(a){this.dragStrategy.endDrag(a)}revertDrag(){this.dragStrategy.revertDrag()}toFlyoutInfo(){const a=Object.assign({},{kind:"BLOCK"},save$$module$build$src$core$serialization$blocks(this)),b=new Set(["id","height","width","pinned","enabled"]),c=function(d){for(const e in d)b.has(e)?delete d[e]:"object"===typeof d[e]&&c(d[e])};
|
||||||
|
c(a);return[a]}};BlockSvg$$module$build$src$core$block_svg.INLINE=-1;BlockSvg$$module$build$src$core$block_svg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var module$build$src$core$block_svg={};module$build$src$core$block_svg.BlockSvg=BlockSvg$$module$build$src$core$block_svg;var DragTarget$$module$build$src$core$drag_target=class{constructor(){}onDragEnter(a){}onDragOver(a){}onDragExit(a){}onDrop(a){}getClientRect(){return null}shouldPreventMove(a){return!1}},module$build$src$core$drag_target={};module$build$src$core$drag_target.DragTarget=DragTarget$$module$build$src$core$drag_target;var module$build$src$core$interfaces$i_deletable={};module$build$src$core$interfaces$i_deletable.isDeletable=isDeletable$$module$build$src$core$interfaces$i_deletable;var DeleteArea$$module$build$src$core$delete_area=class extends DragTarget$$module$build$src$core$drag_target{constructor(){super();this.wouldDelete_=!1}wouldDelete(a){a instanceof BlockSvg$$module$build$src$core$block_svg?(a=!a.getParent()&&a.isDeletable(),this.updateWouldDelete_(a)):this.updateWouldDelete_(isDeletable$$module$build$src$core$interfaces$i_deletable(a)&&a.isDeletable());return this.wouldDelete_}updateWouldDelete_(a){this.wouldDelete_=a}},module$build$src$core$delete_area={};
|
||||||
module$build$src$core$delete_area.DeleteArea=DeleteArea$$module$build$src$core$delete_area;var MetricsManager$$module$build$src$core$metrics_manager=class{constructor(a){this.workspace_=a}getDimensionsPx_(a){let b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return new Size$$module$build$src$core$utils$size(b,c)}getFlyoutMetrics(a){a=this.getDimensionsPx_(this.workspace_.getFlyout(a));return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){const a=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let a=
|
module$build$src$core$delete_area.DeleteArea=DeleteArea$$module$build$src$core$delete_area;var MetricsManager$$module$build$src$core$metrics_manager=class{constructor(a){this.workspace_=a}getDimensionsPx_(a){let b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return new Size$$module$build$src$core$utils$size(b,c)}getFlyoutMetrics(a){a=this.getDimensionsPx_(this.workspace_.getFlyout(a));return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){const a=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let a=
|
||||||
0,b=0;const c=this.getToolboxMetrics(),d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox();var f;const g=!(null==(f=this.workspace_.getFlyout())?0:f.autoClose);f=e?c.position:d.position;const h=f===Position$$module$build$src$core$utils$toolbox.TOP;f===Position$$module$build$src$core$utils$toolbox.LEFT&&(e&&(a+=c.width),g&&(a+=d.width));h&&(e&&(b+=c.height),g&&(b+=d.height));return{top:b,left:a}}getViewMetrics(a){a=a?this.workspace_.scale:1;const b=this.getSvgMetrics(),c=this.getToolboxMetrics(),
|
0,b=0;const c=this.getToolboxMetrics(),d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox();var f;const g=!(null==(f=this.workspace_.getFlyout())?0:f.autoClose);f=e?c.position:d.position;const h=f===Position$$module$build$src$core$utils$toolbox.TOP;f===Position$$module$build$src$core$utils$toolbox.LEFT&&(e&&(a+=c.width),g&&(a+=d.width));h&&(e&&(b+=c.height),g&&(b+=d.height));return{top:b,left:a}}getViewMetrics(a){a=a?this.workspace_.scale:1;const b=this.getSvgMetrics(),c=this.getToolboxMetrics(),
|
||||||
d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox();var f;const g=!(null==(f=this.workspace_.getFlyout())?0:f.autoClose);f=e?c.position:d.position;const h=f===Position$$module$build$src$core$utils$toolbox.LEFT||f===Position$$module$build$src$core$utils$toolbox.RIGHT;if(f===Position$$module$build$src$core$utils$toolbox.TOP||f===Position$$module$build$src$core$utils$toolbox.BOTTOM)e&&(b.height-=c.height),g&&(b.height-=d.height);h&&(e&&(b.width-=c.width),g&&(b.width-=d.width));return{height:b.height/
|
d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox();var f;const g=!(null==(f=this.workspace_.getFlyout())?0:f.autoClose);f=e?c.position:d.position;const h=f===Position$$module$build$src$core$utils$toolbox.LEFT||f===Position$$module$build$src$core$utils$toolbox.RIGHT;if(f===Position$$module$build$src$core$utils$toolbox.TOP||f===Position$$module$build$src$core$utils$toolbox.BOTTOM)e&&(b.height-=c.height),g&&(b.height-=d.height);h&&(e&&(b.width-=c.width),g&&(b.width-=d.width));return{height:b.height/
|
||||||
@@ -1703,4 +1704,4 @@ module$build$src$core$blockly.renderManagement=module$build$src$core$render_mana
|
|||||||
module$build$src$core$blockly.uiPosition=module$build$src$core$positionable_helpers;module$build$src$core$blockly.utils=module$build$src$core$utils;module$build$src$core$blockly.zelos=module$build$src$core$renderers$zelos$zelos;var module$build$src$core$utils$metrics={};var module$build$src$core$renderers$common$i_path_object={};var module$build$src$core$interfaces$i_toolbox_item={};var module$build$src$core$interfaces$i_toolbox={};var module$build$src$core$interfaces$i_styleable={};var module$build$src$core$interfaces$i_serializer={};var module$build$src$core$interfaces$i_registrable={};var module$build$src$core$interfaces$i_procedure_model={};var module$build$src$core$interfaces$i_procedure_map={};var module$build$src$core$interfaces$i_positionable={};var module$build$src$core$interfaces$i_parameter_model={};var module$build$src$core$interfaces$i_movable={};var module$build$src$core$interfaces$i_metrics_manager={};var module$build$src$core$interfaces$i_keyboard_accessible={};var module$build$src$core$interfaces$i_flyout={};var module$build$src$core$interfaces$i_drag_target={};var module$build$src$core$interfaces$i_dragger={};var module$build$src$core$interfaces$i_delete_area={};var module$build$src$core$interfaces$i_contextmenu={};var module$build$src$core$interfaces$i_connection_previewer={};var module$build$src$core$interfaces$i_connection_checker={};var module$build$src$core$interfaces$i_component={};var module$build$src$core$interfaces$i_collapsible_toolbox_item={};var module$build$src$core$interfaces$i_bubble={};var module$build$src$core$interfaces$i_bounded_element={};var module$build$src$core$interfaces$i_autohideable={};var module$build$src$core$interfaces$i_ast_node_location_with_block={};var module$build$src$core$interfaces$i_ast_node_location_svg={};var module$build$src$core$interfaces$i_ast_node_location={};
|
module$build$src$core$blockly.uiPosition=module$build$src$core$positionable_helpers;module$build$src$core$blockly.utils=module$build$src$core$utils;module$build$src$core$blockly.zelos=module$build$src$core$renderers$zelos$zelos;var module$build$src$core$utils$metrics={};var module$build$src$core$renderers$common$i_path_object={};var module$build$src$core$interfaces$i_toolbox_item={};var module$build$src$core$interfaces$i_toolbox={};var module$build$src$core$interfaces$i_styleable={};var module$build$src$core$interfaces$i_serializer={};var module$build$src$core$interfaces$i_registrable={};var module$build$src$core$interfaces$i_procedure_model={};var module$build$src$core$interfaces$i_procedure_map={};var module$build$src$core$interfaces$i_positionable={};var module$build$src$core$interfaces$i_parameter_model={};var module$build$src$core$interfaces$i_movable={};var module$build$src$core$interfaces$i_metrics_manager={};var module$build$src$core$interfaces$i_keyboard_accessible={};var module$build$src$core$interfaces$i_flyout={};var module$build$src$core$interfaces$i_drag_target={};var module$build$src$core$interfaces$i_dragger={};var module$build$src$core$interfaces$i_delete_area={};var module$build$src$core$interfaces$i_contextmenu={};var module$build$src$core$interfaces$i_connection_previewer={};var module$build$src$core$interfaces$i_connection_checker={};var module$build$src$core$interfaces$i_component={};var module$build$src$core$interfaces$i_collapsible_toolbox_item={};var module$build$src$core$interfaces$i_bubble={};var module$build$src$core$interfaces$i_bounded_element={};var module$build$src$core$interfaces$i_autohideable={};var module$build$src$core$interfaces$i_ast_node_location_with_block={};var module$build$src$core$interfaces$i_ast_node_location_svg={};var module$build$src$core$interfaces$i_ast_node_location={};
|
||||||
module$build$src$core$blockly.__namespace__=$;
|
module$build$src$core$blockly.__namespace__=$;
|
||||||
return module$build$src$core$blockly;
|
return module$build$src$core$blockly;
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -594,8 +594,7 @@ class EditorMix extends EditorBase {
|
|||||||
this.showParseMixErrorDialog(mixDom, undefinedBlocks, endFunc);
|
this.showParseMixErrorDialog(mixDom, undefinedBlocks, endFunc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
blockPage.getEditor().clear();
|
Blockly.Xml.clearWorkspaceAndLoadFromXml(xmlDom[0], blockPage.getEditor());
|
||||||
Blockly.Xml.domToWorkspace(xmlDom[0], blockPage.getEditor());
|
|
||||||
blockPage.getEditor().scrollCenter();
|
blockPage.getEditor().scrollCenter();
|
||||||
Blockly.hideChaff();
|
Blockly.hideChaff();
|
||||||
if (!useIncompleteBlocks && codeDom && xmlDom.attr('shown') === 'code') {
|
if (!useIncompleteBlocks && codeDom && xmlDom.attr('shown') === 'code') {
|
||||||
|
|||||||
Reference in New Issue
Block a user