Skip to content

Commit

Permalink
more custom shape
Browse files Browse the repository at this point in the history
  • Loading branch information
jwklong committed Nov 16, 2024
1 parent 96b4b08 commit bfaa29c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,9 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) {
if (field) {
fieldStack.push([field, element['name']]);
} else if (input) {
if (element['shape']) {
input.setShape(element['shape']);
}
if (element['check']) {
input.setCheck(element['check']);
}
Expand Down
8 changes: 8 additions & 0 deletions core/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ Blockly.Input.prototype.setCheck = function(check) {
return this;
};

Blockly.Input.prototype.setShape = function(shape) {
if (!this.connection) {
throw 'This input does not have a connection.';
}
this.connection.setShape(shape);
return this;
};

/**
* Change the alignment of the connection's field(s).
* @param {number} align One of Blockly.ALIGN_LEFT, ALIGN_CENTRE, ALIGN_RIGHT.
Expand Down

0 comments on commit bfaa29c

Please sign in to comment.