Skip to content

Commit a92e959

Browse files
committed
polish branched procedures
1 parent 9f59c01 commit a92e959

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

blocks_vertical/procedures.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Blockly.ScratchBlocks.ProcedureUtils.createAllInputs_ = function(connectionMap)
313313
*/
314314
labelText = component.substring(2).trim();
315315

316-
if (argumentType == "c") {
316+
if (argumentType == 'c') {
317317
var input = this.appendStatementInput(id)
318318
} else {
319319
var input = this.appendValueInput(id);
@@ -530,7 +530,7 @@ Blockly.ScratchBlocks.ProcedureUtils.populateArgumentOnCaller_ = function(type,
530530
if (connectionMap && oldBlock) {
531531
// Reattach the old block and shadow DOM.
532532
connectionMap[input.name] = null;
533-
if (type == "c") {
533+
if (type == 'c') {
534534
oldBlock.previousConnection.connect(input.connection);
535535
} else {
536536
oldBlock.outputConnection.connect(input.connection);
@@ -588,7 +588,7 @@ Blockly.ScratchBlocks.ProcedureUtils.populateArgumentOnPrototype_ = function(
588588
}
589589

590590
// Attach the block.
591-
if (type == "c") {
591+
if (type == 'c') {
592592
input.connection.connect(argumentReporter.previousConnection);
593593
} else {
594594
input.connection.connect(argumentReporter.outputConnection);
@@ -634,7 +634,7 @@ Blockly.ScratchBlocks.ProcedureUtils.populateArgumentOnDeclaration_ = function(
634634
}
635635

636636
// Attach the block.
637-
if (type == "c") {
637+
if (type == 'c') {
638638
input.connection.connect(argumentEditor.previousConnection);
639639
} else {
640640
input.connection.connect(argumentEditor.outputConnection);

core/block_render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) {
13861386
// Width of the curve/pointy-curve
13871387
var shape = this.getOutputShape();
13881388
if (shape != Blockly.OUTPUT_SHAPE_SQUARE) {
1389-
this.edgeShapeWidth_ = inputRows.bottomEdge / 2;
1389+
this.edgeShapeWidth_ = (inputRows.bottomEdge + Math.max(this.inputList.filter(v => v.type == Blockly.NEXT_STATEMENT).length-1, 0) * Blockly.BlockSvg.NOTCH_WIDTH) / 2;
13901390
this.edgeShape_ = shape;
13911391
this.squareTopLeftCorner_ = true;
13921392
}

tests/custom_procedure_playground.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<td id="editor-actions">
5656
<button id="text_number" onclick="addTextNumber()">Add text/number input</button>
5757
<button id="boolean" onclick="addBoolean()">Add boolean input</button>
58+
<button id="command" onclick="addCommand()">Add command input</button>
5859
<button id="label" onclick="addLabel()">Add label</button>
5960
<button id="cancelButton" onclick="cancel()">cancel</button>
6061
<button id="okButton" onclick="applyMutation()">ok</button>
@@ -232,6 +233,10 @@
232233
mutationRoot.addStringNumberExternal();
233234
}
234235

236+
function addCommand() {
237+
mutationRoot.addCommandExternal();
238+
}
239+
235240
function setOutput(type) {
236241
mutationRoot.setReturns(true);
237242
mutationRoot.setType(type);

0 commit comments

Comments
 (0)