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

[Bug]: closePath command should set the current point to the initial point in the subpath #16

Open
ShukantPal opened this issue Nov 29, 2020 · 5 comments

Comments

@ShukantPal
Copy link

I used your code in @pixi-essentials/svg @bigtimebuddy. Haha, and got this strange bug that messed up my client's figures.

I realized it occurred at 'm' (relative) commands after 'Z' (closePath). It was because you aren't updating the current point after closing the path.

In the SVG specification (section 8.3.3), it says:

At the end of the command, the new current point is set to the initial point of the current
subpath.

Just wanted to forward this fix from @pixi-essentials/svg to here.

x = this.currentPath.points[0] || 0;
y = this.currentPath.points[1] || 0;

this.closePath();

(here

this.closePath();
)

@bigtimebuddy
Copy link
Owner

I'm also okay sun-setting this module in favor of your SVG. Does it do the same stuff?

@ShukantPal
Copy link
Author

@pixi-essentials/svg generates a scene graph instead of generating a single large Graphics object. It supports a much wider (the widest?) feature set and is larger. But yeah, the base SVG concept is the same.

@bigtimebuddy
Copy link
Owner

Could you make a mode where is combines/flattens In addition to exploded graph? I see both as being useful and that actually was a feature request someone made here. If you flatten it avoids all the transforms but at the expense of flexibility, exploded view is much better for animation.

@ShukantPal
Copy link
Author

ShukantPal commented Nov 29, 2020

A flattening mode would be severely limited w.r.t. the exploded view. It is impossible to support (which otherwise @pixi-essentials/svg already has):

  • text, image, defs, use elements
  • masking
  • transforms
  • culling (yea, @pixi-essentials/svg automatically culls its internal scene graph)

From outside, however, SVGScene is a DisplayObject and has no children. Its scene graph is kept totally disconnected from the user's scene graph (i.e is internal & hidden).

From an API standpoint, I don't see how a flattened mode wouldn't be useful b/c @pixi-essentials/svg exposes a SVGScene, which is not a Graphics object. Why do think a flattened mode is useful?

@bigtimebuddy
Copy link
Owner

Maybe it's not that useful. What you describe would still allow users to do RenderTexture or cacheAsBitmap for performance, which is good. The only advantage of flattening is if you have a very complex SVG and then you'd need to allocate a large pixi scene graph. Whereas, representing it as pure geometry is probably more memory efficient as complexity scales. Overall, I like your approach better. What I'm describing is probably more of an edge-case and could be added later if there's a need.

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

No branches or pull requests

2 participants