From 6744fa752a02061646c7efe5eaf4067af2a8d18b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 22:06:06 +0000 Subject: [PATCH 1/2] Fix(zelos): Remove extra vertical line on hat blocks Blocks with hats in the Zelos renderer would sometimes have an extra vertical line segment drawn on their right side when no block was connected below them. This was caused by the `drawTop_` method in the common drawer unconditionally drawing a vertical line for the top row, which was not coordinated with the rest of the block's path drawing for this specific case. The fix is to override `drawTop_` in the Zelos drawer and only draw the vertical line if the block does not have a hat, or if a block is connected to its next connection. This is determined by checking the `isConnected()` status of the next connection. --- core/renderers/zelos/drawer.ts | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/renderers/zelos/drawer.ts b/core/renderers/zelos/drawer.ts index 009247aeae4..cafb55e23a7 100644 --- a/core/renderers/zelos/drawer.ts +++ b/core/renderers/zelos/drawer.ts @@ -14,6 +14,7 @@ import {Drawer as BaseDrawer} from '../common/drawer.js'; import {Connection} from '../measurables/connection.js'; import type {InlineInput} from '../measurables/inline_input.js'; import {OutputConnection} from '../measurables/output_connection.js'; +import type {PreviousConnection} from '../measurables/previous_connection.js'; import type {Row} from '../measurables/row.js'; import type {SpacerRow} from '../measurables/spacer_row.js'; import {Types} from '../measurables/types.js'; @@ -86,6 +87,40 @@ export class Drawer extends BaseDrawer { } } + protected override drawTop_() { + const topRow = this.info_.topRow; + const elements = topRow.elements; + + this.positionPreviousConnection_(); + this.outlinePath_ += svgPaths.moveBy(topRow.xPos, this.info_.startY); + for (let i = 0, elem; (elem = elements[i]); i++) { + if (Types.isLeftRoundedCorner(elem)) { + this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topLeft; + } else if (Types.isRightRoundedCorner(elem)) { + this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topRight; + } else if ( + Types.isPreviousConnection(elem) && + elem instanceof Connection + ) { + this.outlinePath_ += ( + (elem as PreviousConnection).shape as Notch + ).pathLeft; + } else if (Types.isHat(elem)) { + this.outlinePath_ += this.constants_.START_HAT.path; + } else if (Types.isSpacer(elem)) { + this.outlinePath_ += svgPaths.lineOnAxis('h', elem.width); + } + } + // No branch for a square corner, because it's a no-op. + const hasHat = 'hasHat' in topRow && topRow.hasHat; + const nextConnection = this.info_.bottomRow.connection; + const isConnected = nextConnection?.connectionModel?.isConnected() ?? false; + + if (!hasHat || isConnected) { + this.outlinePath_ += svgPaths.lineOnAxis('v', topRow.height); + } + } + /** * Add steps for the right side of a row that does not have value or * statement input connections. From f8bccb075a1b56596e3f207aead3e2e9331b25e0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 22:15:08 +0000 Subject: [PATCH 2/2] Fix(zelos): Remove extra vertical line on hat blocks Blocks with hats in the Zelos renderer would sometimes have an extra vertical line segment drawn on their right side when no block was connected below them. This was caused by the `drawTop_` method in the common drawer unconditionally drawing a vertical line for the top row, which was not coordinated with the rest of the block's path drawing for this specific case. The fix is to override `drawTop_` in the Zelos drawer and only draw the vertical line if the block does not have a hat, or if a block is connected to its next connection. This is determined by checking the `isConnected()` status of the next connection.