question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for reversing the path

See original GitHub issue

Are there any plans to have support for reversing the path?

const path = svgpath(__your_path__)
const reversed = path.reverse();
Direct Path Inverse Path
d="M50,300 L50,250 C50,150 75,150 100,250 C150,450 200,450 200,250 Q200,100 400,100" d="M400,100 Q200,100 200,250 C200,450 150,450 100,250 C75,150 50,150 50,250 L50,300"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
puzrincommented, May 30, 2020

I did not declined .reverse() yet. IMO, those are candidates to add by priority:

  1. .from() - useful for clone-related things in extentions
  2. .bbox() => [x, y, w, h] - PR closed, but feature not declined
  3. .reverse() - just because not trivial but small, and fits well into svgpath api.

If (2) & (3) cost no much time for me [read as “your code can be reused” 😃] - i have no principal objections and can prepare commits.

1reaction
puzrincommented, May 30, 2020

IMO, countours split task is:

a) specific b) primitive (has trivial implementation, string.split(/(?<=[zZ])\s*(?=[mM])/g))

=> not a good candidate.

Consider svgpath not as lib with thousand of method, but as engine easy to extend.

May be, it worth add SvgPath.from() (like Array.from()) for easy data clone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I inverse/reverse a path? - Adobe Support Community
Since an update long ago all paths I create become inverse. Anyone know what the settings need to be to avoid this? Or...
Read more >
Support for Compile ("Reverse" Path-To-RegExp)? #41 - GitHub
Adding compile() based on the pattern support should be simple - path-to-regexp implementation is pretty short (even with the regexp validation ...
Read more >
What is the "reverse" path in the case of a piecewise defined ...
You want to map a to γ2(d), b and c to γ2(c)=γ1(b) and d to γ1(a). Looking for a linear map φ(t)=At+B taking...
Read more >
Reverse-path forwarding - Wikipedia
Reverse -path forwarding (RPF) is a technique used in modern routers for the purposes of ensuring loop-free forwarding of multicast packets in multicast ......
Read more >
Reverse tree path - GeeksforGeeks
Given a tree and node data, the task to reverse the path to that particular Node. ... The idea is to use a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found