I'm have some old problems with my extension that I get frequent requests from users about fixing. Now that I am working on a new version maybe I might make an attempt.
The problem is that I copy subtrees (contents of specific groups) of the SVG, putting multiple copies (often slightly modified) elsewhere in the document. Gradients for instance break since I have to recaltulate the transform to apply to them to make it look identical to the copied element (similar to what Inkscape itself does when Move Gradients is enabled).
Are there any available tools to handle this? Or any clever SVG tricks that makes this easier than I think it is? It seems as if a solution requires a full "rendering" of the SVG, calculating the transformation matrix that applies to every element and recaltulating how to apply it for the copy.
Also sometimes a href:xlink in a use element is changed in the copy. But the use element has a translation transform set, corresponding to how much the referenced object must be translated to appear in the intended position. But when the xlink is changed there is suddenly another element to translate. This also seems difficult. For one thing, some elements have x, y coordinates, but others do not. I tried to use sodipodi:cx and sodipodi:cy for elements that have those, but the values I get looks somewhat random. Some circles (that are in fact svg:path objects) have a cx in the center, but another has it on the edge of the circle. If the original group of objects being copied has a clone (use element) in the center, the copy having a different xlink value will have the clone appear slightly off-center. Looking for some kind of workaround for this as well, like a helper function that can calculate the exact center coordinates of any given svg element (as seen by Inkscape)? That would be very useful. Or even better of course a helper function to let me modify the href:xlink and just magically also modify the transform attribute properly. But I can't find any other extension doing anything similar?
Transforms properly in extension
Re: Transforms properly in extension
Regarding the use elements: One workaround found by one of my users is to make sure all the possible elements to use for the xlink reference are centered on the same position in the SVG file. This isn't easy to maintain when there are many possible elements to reference. Another workaround I prefer myself is to render the elements to bitmap and use image elements instead, since then there is no problem with translations.