Skip to content

fix: keep tall field corners inside round caps with zelos - #10214

Open
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:zelos-caps
Open

fix: keep tall field corners inside round caps with zelos#10214
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:zelos-caps

Conversation

@mikeharv

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes RaspberryPiFoundation/blockly-samples#2021

Proposed Changes

For round blocks using the Zelos renderer, negative (inset) cap spacing now uses height-aware circle clearance instead of a fixed centerline-only pad. Tall rectangular fields (images, bitmaps) no longer clip through the rounded ends.

bitmap field after image field after

This also widens an existing tight-nesting special case from FieldTextInput to FieldInput, so number fields get the same treatment as text inputs (about 2px narrower on simple number reporters). This isn't related to the reported bug.

Reason for Changes

With the Zelos renderer, round connections reserve a full rounded cap width on each side. Content is then pulled into those caps so it nests inside the curve rather than sitting in a rectangular box beside the cap.
If a tall rectangular field on the left/right edge of a pill-shaped block, the field’s corners stick out through the curved cap outline. This only happened when the field is tall enough relative to the cap radius (roughly >30). Normal short fields/icons looked fine. The old code treated every field like round centerline content, and under-padded tall rectangles inside round caps.

bitmap field before image field before

Note that bug report was for bitmap fields specifically, but the bug applies to all potentially tall rectangular fields.

Test Coverage

  • Added tests/mocha/zelos_info_test.js. The test renders a 75×75 image on a single-field block and checks that the total horizontal pad is above the old centerline-only pad (24px) and below full-cap width (84px).
  • Manually verified tall bitmap and image reporters in the Zelos playground (before/after screenshots above), plus a simple math_number block for the FieldInput nesting tweak (nearly identical, now 2px narrower). No changes observed on any other field types.

@mikeharv
mikeharv requested a review from a team as a code owner July 30, 2026 21:13
@mikeharv
mikeharv requested a review from gonfunko July 30, 2026 21:13
@github-actions github-actions Bot added the PR: fix Fixes a bug label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bitmap field renders outside of block bounds in zelos

2 participants