From bfaa29c76b2033380da4e6d3128b8a9817a40df2 Mon Sep 17 00:00:00 2001 From: jwklong Date: Sat, 16 Nov 2024 09:36:55 +0000 Subject: [PATCH] more custom shape --- core/block.js | 3 +++ core/input.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/core/block.js b/core/block.js index 955b01c72d..c799d023f5 100644 --- a/core/block.js +++ b/core/block.js @@ -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']); } diff --git a/core/input.js b/core/input.js index 91bb4f12bf..6c23e30d86 100644 --- a/core/input.js +++ b/core/input.js @@ -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.