Skip to content

Conversation

@vltansky
Copy link
Contributor

@vltansky vltansky commented Feb 3, 2025

SVGPathCommander.reversePath expecting PathArray while example in docs uses string

Copy link
Owner

@thednp thednp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, some parts of the docs aren't up to date.

However, to reverse a path, it's enough to parse it first, normalizing it would cost more juicy ms.

@vltansky
Copy link
Contributor Author

vltansky commented Feb 3, 2025

so what should be the recommended way?

const path = SVGPathCommander.parsePathString(compData.path);
const reversedPath = SVGPathCommander.reversePath(path);

// or
const reversedPath = SVGPathCommander.parsePathString(path).reverse();
// or
const reversedPath = new SVGPathCommander(compData.path).reverse()

also should .toString() be added for the current example in docs?

@vltansky vltansky requested a review from thednp February 3, 2025 11:45
Copy link
Owner

@thednp thednp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@thednp thednp merged commit 4f90ff5 into thednp:master Feb 3, 2025
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