From 9df7f9d4460cc4133c3bc2c0e347078a3562d143 Mon Sep 17 00:00:00 2001 From: fangqijun Date: Mon, 31 Jul 2023 18:07:04 +0800 Subject: [PATCH 1/2] fix(blocks): boolean variable block wrong shape for zelos --- blocks/variables_dynamic.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blocks/variables_dynamic.ts b/blocks/variables_dynamic.ts index fed8cbcb3c1..8af4608c716 100644 --- a/blocks/variables_dynamic.ts +++ b/blocks/variables_dynamic.ts @@ -25,6 +25,7 @@ import { defineBlocks, } from '../core/common.js'; import '../core/field_label.js'; +import type {BlockSvg} from '../core/block_svg.js'; /** * A dictionary of the block definitions provided by this module. @@ -156,6 +157,10 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { } else { this.getInput('VALUE')!.connection!.setCheck(variableModel.type); } + + if (this.rendered) { + (this as BlockSvg).queueRender(); + } }, }; From 9e70a31afc99178f09a7d91df780e2efe950a488 Mon Sep 17 00:00:00 2001 From: fangqijun Date: Tue, 1 Aug 2023 01:17:27 +0800 Subject: [PATCH 2/2] fixup! fix(blocks): boolean variable block wrong shape for zelos --- blocks/variables_dynamic.ts | 5 ----- core/rendered_connection.ts | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/blocks/variables_dynamic.ts b/blocks/variables_dynamic.ts index 8af4608c716..fed8cbcb3c1 100644 --- a/blocks/variables_dynamic.ts +++ b/blocks/variables_dynamic.ts @@ -25,7 +25,6 @@ import { defineBlocks, } from '../core/common.js'; import '../core/field_label.js'; -import type {BlockSvg} from '../core/block_svg.js'; /** * A dictionary of the block definitions provided by this module. @@ -157,10 +156,6 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { } else { this.getInput('VALUE')!.connection!.setCheck(variableModel.type); } - - if (this.rendered) { - (this as BlockSvg).queueRender(); - } }, }; diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index f6a60627995..4d358eae909 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -625,6 +625,22 @@ export class RenderedConnection extends Connection { this.sourceBlock_.bumpNeighbours(); } } + + /** + * Change a connection's compatibility. + * Rerender blocks as needed. + * + * @param check Compatible value type or list of value types. Null if all + * types are compatible. + * @returns The connection being modified (to allow chaining). + */ + override setCheck(check: string | string[] | null): RenderedConnection { + super.setCheck(check); + if (this.sourceBlock_.rendered) { + this.sourceBlock_.queueRender(); + } + return this; + } } export namespace RenderedConnection {