Skip to content

Commit 9ee6352

Browse files
committed
Fix issue when neckHeightRatio was set to 1
1 parent bc752d5 commit 9ee6352

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/funnel/src/hooks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@ function computeShapedParts<D extends FunnelDatum>(
523523
partHeight = (datum.value / totalValue) * innerHeight
524524
y0 = currentHeight
525525
y1 = y0 + partHeight
526-
const inBottomThird = y0 > neckHeight
527526

528-
partWidth = inBottomThird
527+
const inNeck = neckHeightRatio >= 1 || y0 > neckHeight
528+
partWidth = inNeck
529529
? neckWidth
530530
: innerWidth - 2 * (Math.round((currentHeight / slope) * 10) / 10)
531531
x0 = paddingBefore + (innerWidth - partWidth) * 0.5
@@ -535,9 +535,9 @@ function computeShapedParts<D extends FunnelDatum>(
535535
partWidth = (datum.value / totalValue) * innerWidth
536536
x0 = currentWidth
537537
x1 = x0 + partWidth
538-
const inLastThird = x0 > neckHeight
539538

540-
partHeight = inLastThird
539+
const inNeck = neckHeightRatio >= 1 || x0 > neckHeight
540+
partHeight = inNeck
541541
? neckWidth
542542
: innerHeight - 2 * (Math.round((currentWidth / slope) * 10) / 10)
543543
y0 = paddingBefore + (innerHeight - partHeight) * 0.5

0 commit comments

Comments
 (0)