Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to use d3-shape with SvgLine #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Rich-Harris
Copy link
Owner

(and SvgArea?)

@jdomeij
Copy link

jdomeij commented Jan 10, 2021

Why not allow custom svg generator to be passed to SvgLine, this will prevent pancake to depend on d3-shape if not needed (it also allows more custom modifiers for the shape).

I have added this feature to my modified version of pancake (jdomeij@3064c8d)

If then want to use d3-shape you only need to override the default svg generator with customized d3-shape like

  import { line as d3Line, curveCardinal } from 'd3-shape';
  const d3Curve = curveCardinal.tension(0);
  const d3LineFunc = d3Line().curve(d3Curve).x(p=>p.x).y(p=>p.y);

<Pancake.SvgLine data={points} line={d3LineFunc} let:d>

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.

2 participants