@plait/core: isPointInRoundRectangle ignores the bottom-left corner cutout
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- frontend
Research direction
The bug is in isPointInRoundRectangle in packages/core/src/utils/math.ts. The handleLeftBottom y-range check at lines 290-291 is inverted, so compare it with handleRightBottom, which is correct. Run the four-point repro from the issue before and after the change. Done when [1, 9] returns false and the other three corners still return the same results.
Written by the indexing model from the issue text.
Description
isPointInRoundRectangle returns true for points in the bottom-left corner outside the corner arc because the handleLeftBottom y-range check is inverted.
// node repro.mjs (after `npm i @plait/[email protected]`)
import { isPointInRoundRectangle } from "@plait/core";
const rect = { x: 0, y: 0, width: 20, height: 10 };
console.log(isPointInRoundRectangle([1, 1], rect, 4)); // false (top-left corner cut off)
console.log(isPointInRoundRectangle([19, 1], rect, 4)); // false (top-right corner cut off)
console.log(isPointInRoundRectangle([19, 9], rect, 4)); // false (bottom-right corner cut off)
console.log(isPointInRoundRectangle([1, 9], rect, 4)); // true (bottom-left corner NOT cut off)
Actual output:
false
false
false
true
Expected output:
false
false
false
false
[1, 9] is at distance Math.hypot(3, 3) = 4.24 > 4 from the bottom-left arc center [4, 6], so it lies outside the rounded corner just like the other three corners. In packages/core/src/utils/math.ts lines 290-291, handleLeftBottom checks point[1] >= rectY + height && point[1] <= rectY + height - radius, which is always false for positive radius; it should be point[1] >= rectY + height - radius && point[1] <= rectY + height (matching handleRightBottom).
Version: @plait/[email protected] and develop (e0d76b0942) on Node v26.13.0.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Credit: https://ucsbplse.github.io/
- Dominant language
- TypeScript
- Stars
- 703
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from worktile/plait
-
area: tooling tracking
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
area: mind design enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
area: table design enhancement
Difficulty 5/5 Over a week Newbie friendliness 28/100
-
area: text bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
documentation tracking
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
milind-soni/OpenMausBot#6730 ·
Maintainers usually reply within 1 day
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:image documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day