Skip to content

Commit 87488ca

Browse files
committed
fix(GeoPath): Improve performance by only using custom geoCurvePath when curve overridden
1 parent b7af0b3 commit 87488ca

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.changeset/loud-paws-allow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(GeoPath): Improve performance by only using custom geoCurvePath when `curve` overridden

packages/layerchart/src/lib/components/GeoPath.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import type { TooltipContextValue } from './tooltip/TooltipContext.svelte';
66
import { curveLinearClosed, type CurveFactory, type CurveFactoryLineOnly } from 'd3-shape';
77
import {
8+
geoPath as d3GeoPath,
89
geoTransform as d3geoTransform,
910
type GeoIdentityTransform,
1011
type GeoPermissibleObjects,
@@ -105,6 +106,10 @@
105106
const geoPath = $derived.by(() => {
106107
geojson;
107108
if (!projection) return;
109+
// Only use geoCurvePath for custom curves (performance impact)
110+
if (curve === curveLinearClosed) {
111+
return d3GeoPath(projection);
112+
}
108113
return geoCurvePath(projection, curve);
109114
});
110115

0 commit comments

Comments
 (0)