Skip to content

Commit 69ce37a

Browse files
committed
refactor: Fixed circular detection using top left when badge width was larger than the detected inset
`Math.sqrt` with a negative number returns `NaN`.
1 parent f47fec9 commit 69ce37a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/calculateCircularBadgePosition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function calculateCircularBadgePosition(
2323
// Calculate the distance from the center of the container to the bottom-center of
2424
// the badge.
2525
const distance = Math.sqrt(
26-
Math.pow(circleRadius, 2) - Math.pow(badge.width / 2, 2),
26+
Math.max(0, Math.pow(circleRadius, 2) - Math.pow(badge.width / 2, 2)),
2727
);
2828

2929
const trigAngle = ((angle - 90) * Math.PI) / 180;

0 commit comments

Comments
 (0)