Skip to content

fix(core): apply the bottom-left corner cutout in isPointInRoundRectangle - #1172

Open
yuxino wants to merge 1 commit into
worktile:developfrom
yuxino:fix/round-rectangle-left-bottom-hit
Open

yuxino wants to merge 1 commit into
worktile:developfrom
yuxino:fix/round-rectangle-left-bottom-hit

Conversation

@yuxino

@yuxino yuxino commented Dec 1, 2026

Copy link
Copy Markdown

Summary

isPointInRoundRectangle never applied the bottom-left corner cutout: the y-range check in handleLeftBottom was inverted (point[1] >= rectY + height && point[1] <= rectY + height - radius, always false for a positive radius), so points outside the bottom-left arc were still reported as inside the shape. The other three corners worked. This affects hit testing for rounded shapes (round-rectangle, round-comment, flowchart terminal). The fix swaps the range to match handleRightBottom. Affected package: @plait/core.

Related Issue

Closes #1171

Validation

  • Applicable checks pass: lint, build, and tests
  • Relevant documentation and examples were verified or are not applicable

Evidence and compatibility notes:

  • Reproduced on the published @plait/core@0.94.1 and on develop e0d76b09: for { x: 0, y: 0, width: 20, height: 10 } with radius 4, isPointInRoundRectangle([1, 9], …) returned true while the equivalent points at the other three corners returned false.
  • New specs in math.spec.ts fail on the pre-fix code (1 FAILED / 72 SUCCESS) and pass with the fix (73 SUCCESS).
  • npm run build and npm run ci:test pass locally (Node v26.13.0, ChromeHeadlessCI); npm run lint was run.
  • No public API signature change; the hit area now matches the drawn rounded corner. All three callers use plain hit testing with no workaround for the old behavior.

Changeset

  • A changeset was added when required (@plait/core patch)
  • No changeset is required

AI Assistance

  • No

  • Yes

  • Tool/model: Qoder coding agent (model name not exposed by the tool)

  • AI-assisted work: the math.ts fix, the new specs, and the changeset

  • My review and validation: verified the inverted range against the issue repro and the other three corner handlers, checked all callers for compensating workarounds, and ran the baseline-vs-fixed test comparison plus the full build and ci:test listed above.

  • I reviewed and understand the AI-assisted changes and can explain and maintain them

Checklist

  • The title and description are in English, and the change is focused
  • I reviewed and understand every submitted change
  • Tests, documentation, and examples were updated when needed
  • Public API and data compatibility were considered

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@plait/core: isPointInRoundRectangle ignores the bottom-left corner cutout

1 participant