thi-ng / umbrella

⛱ Broadly scoped ecosystem & mono-repository of 198 TypeScript projects (and ~175 examples) for general purpose, functional, data driven development
https://thi.ng
Apache License 2.0
3.31k stars 144 forks source link

[geom] `withAttribs(path, {})` closes the path #431

Closed cdaein closed 8 months ago

cdaein commented 8 months ago

I've noticed that when a path is passed to withAttribs(), it closes the path. I was hoping to keep my path open as it was - wondering if there's a reason to close it by default.

from the source: https://github.com/thi-ng/umbrella/blob/14369264434e7a1210425b4f69330b528ad1e8b0/packages/geom/src/api/path.ts#L43

an example code:

  const c1 = cubic([100, 100], [300, 100], [400, 100], [400, 400]);
  const c2 = cubic([400, 400], [400, 600], [500, 600], [700, 700]);
  const path = pathFromCubics([c1, c2], { stroke: `red` });
  console.log(path); // closed:false
  console.log(withAttribs(path, {})); // closed:true

  draw(
    ctx,
    group({ __background: `black` }, [path, withAttribs(path, { alpha: 0.5 })]),
  );
postspectacular commented 8 months ago

Hi @cdaein - thanks for spotting this, I've just updated the impl and will push a new release asap! 👍

postspectacular commented 7 months ago

Sorry, forgot to reply here that I've released an update a few days ago.... hope you've noticed by now! :)

cdaein commented 7 months ago

thank you for the update!