svg.topoly.js icon indicating copy to clipboard operation
svg.topoly.js copied to clipboard

Add support for merged paths (M..Z M..Z M..Z)

Open peteruithoven opened this issue 11 years ago • 13 comments

peteruithoven avatar Jul 29 '14 16:07 peteruithoven

Any questions? :)

wout avatar Jul 29 '14 18:07 wout

No... I'm just used to using issues as todo's ;)

peteruithoven avatar Jul 29 '14 18:07 peteruithoven

LOL :)

wout avatar Jul 29 '14 19:07 wout

Quick question, how about you becoming a collaborator on this plugin? That way you don't have to send out pull requests every time.

wout avatar Jul 30 '14 16:07 wout

That would be nice :)

peteruithoven avatar Jul 30 '14 16:07 peteruithoven

Done! :)

wout avatar Jul 30 '14 18:07 wout

Just wondering, how would you solve this? I was thinking that in case of more than one path, a group is created wrapping the individual polygon / polyline elements. That way the converted shape can be moved as a whole.

wout avatar Aug 01 '14 07:08 wout

Interesting issue, mainly what to return is tricky right? I was thinking of using an array or svg.js set. But when your editing I agree that it would be nice to have these formally merged paths grouped. Your solution will also work nicely with the ungroup plugin I hope to write. It will require a warning in the docs anyway I think (that it can also return a group reference).

peteruithoven avatar Aug 01 '14 09:08 peteruithoven

An instance of SVG.Set would also work. Although, calling move() on a set will move all parts to the given x and y by their upper left corner. So in that case a group provides more expected behaviour when manipulating afterwards.

About the ungroup plugin, I would accept this feature to the core. Maybe a good one to add to the list of rc.11 when the new matrix transformations are implemented in rc.10.

wout avatar Aug 01 '14 09:08 wout

Nice, I've been reading the references readme already.

peteruithoven avatar Aug 01 '14 09:08 peteruithoven

Great :) Just a tip, if you clone the reference branch and run gulp docs, the REAME will be converted to the more readable documentup layout.

wout avatar Aug 01 '14 09:08 wout

Are there any progress? This is a useful feature...

afocus avatar Aug 20 '17 05:08 afocus

Your best approach would be to split your path at M commands and convert them to polygons one by one.

Fuzzyma avatar Jan 21 '19 12:01 Fuzzyma