fix: keep tall field corners inside round caps with zelos - #10214
Open
mikeharv wants to merge 2 commits into
Open
fix: keep tall field corners inside round caps with zelos#10214mikeharv wants to merge 2 commits into
mikeharv wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
This also widens an existing tight-nesting special case from
FieldTextInputtoFieldInput, 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.
Note that bug report was for bitmap fields specifically, but the bug applies to all potentially tall rectangular fields.
Test Coverage
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).math_numberblock for theFieldInputnesting tweak (nearly identical, now 2px narrower). No changes observed on any other field types.