Would there be a way to weld 2 overlapping svg paths together into one unified single path using javascript?
Asked
Active
Viewed 928 times
0
-
you can just copy the content of the »d« of one directly into the others' one, make sure that no »close« command comes in between, but the result may not be what you expect because of transforms and so on (converting both into the »absolute« space might be a good idea). How do want to exactly combine the paths? What do you want to achive? – philipp Feb 21 '13 at 22:56
-
Well i am doing a modification of svg-edit. I want when my users draw shapes that overlap with other shapes the 2 shapes to be combined into a unified shape. The solution you gave me probably groups the 2 paths. It doesnt weld them together. Any ideas? – nicholaswmin Feb 21 '13 at 23:00
-
1welding, in your case, means to execute all drawing commands (the data inside the »d« attribute) of both paths inside one. But since coordinates may be transformed you need to convert both into the same space and than »weld« them. – philipp Feb 21 '13 at 23:05
-
So welding as you described it is possible to happen just the way i want it to? – nicholaswmin Feb 21 '13 at 23:07
-
»welding paths« that is quiet abstract... If it makes sense than: yes, but why should one path containing the data of two (or more) be better than all together, even if they show up the same shape? what do want to achieve, or what for? – philipp Feb 21 '13 at 23:15
-
any way we could chat? – nicholaswmin Feb 21 '13 at 23:20
-
let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/24936/discussion-between-nicholas-kyriakides-and-philipp) – nicholaswmin Feb 21 '13 at 23:21
-
Similar question: http://stackoverflow.com/questions/13252056/svg-union-of-shapes-using-javascript-or-d3-or-inkscape-script-like-inkscape-gui – Erik Dahlström Feb 22 '13 at 12:03
-
i need something that works with js i think. – nicholaswmin Feb 22 '13 at 23:31