From 8c44d8498017731e0799ec4c07f9abe1c2506a3a Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 2 Oct 2023 13:16:03 -0700 Subject: [PATCH 1/2] fix: color field sizing being incorrect (#7566) (cherry picked from commit 5151b28e7dc5bb1cf8ad7e620e8eb1ff5bfcc716) --- core/field_colour.ts | 26 +++++++++----------------- core/renderers/zelos/constants.ts | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/core/field_colour.ts b/core/field_colour.ts index 1b022b64c..de771c9af 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -262,28 +262,20 @@ export class FieldColour extends Field { */ protected updateSize_(margin?: number) { const constants = this.getConstants(); - const xOffset = - margin !== undefined - ? margin - : !this.isFullBlockField() - ? constants!.FIELD_BORDER_RECT_X_PADDING - : 0; - let totalWidth = xOffset * 2; - let contentWidth = 0; - if (!this.isFullBlockField()) { - contentWidth = constants!.FIELD_COLOUR_DEFAULT_WIDTH; - totalWidth += contentWidth; - } - - let totalHeight = constants!.FIELD_TEXT_HEIGHT; - if (!this.isFullBlockField()) { - totalHeight = Math.max(totalHeight, constants!.FIELD_BORDER_RECT_HEIGHT); + let totalWidth; + let totalHeight; + if (this.isFullBlockField()) { + const xOffset = margin ?? 0; + totalWidth = xOffset * 2; + totalHeight = constants!.FIELD_TEXT_HEIGHT; + } else { + totalWidth = constants!.FIELD_COLOUR_DEFAULT_WIDTH; + totalHeight = constants!.FIELD_COLOUR_DEFAULT_HEIGHT; } this.size_.height = totalHeight; this.size_.width = totalWidth; - this.positionTextElement_(xOffset, contentWidth); this.positionBorderRect_(); } diff --git a/core/renderers/zelos/constants.ts b/core/renderers/zelos/constants.ts index e13a57e52..73a600c58 100644 --- a/core/renderers/zelos/constants.ts +++ b/core/renderers/zelos/constants.ts @@ -217,9 +217,9 @@ export class ConstantProvider extends BaseConstantProvider { this.FIELD_DROPDOWN_SVG_ARROW_PADDING = this.FIELD_BORDER_RECT_X_PADDING; - this.FIELD_COLOUR_DEFAULT_WIDTH = 2 * this.GRID_UNIT; + this.FIELD_COLOUR_DEFAULT_WIDTH = 6 * this.GRID_UNIT; - this.FIELD_COLOUR_DEFAULT_HEIGHT = 4 * this.GRID_UNIT; + this.FIELD_COLOUR_DEFAULT_HEIGHT = 8 * this.GRID_UNIT; this.FIELD_CHECKBOX_X_OFFSET = 1 * this.GRID_UNIT; From f380159e3542f9b458c83fff1b372c735ad83f11 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 2 Oct 2023 13:20:11 -0700 Subject: [PATCH 2/2] release: Update version number to 10.2.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33ff09617..6ef9dbfe9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "10.2.0", + "version": "10.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "blockly", - "version": "10.2.0", + "version": "10.2.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index d0c8d2718..78dff1655 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.2.0", + "version": "10.2.1", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly"