cloned objects shifted after unlink clone

Post questions on how to use or achieve an effect in Inkscape.
akuls
Posts: 4
Joined: Wed Apr 25, 2012 6:05 pm

cloned objects shifted after unlink clone

Postby akuls » Wed Apr 25, 2012 6:19 pm

I have a problem with Inkscape clone behavior. I should edit svg file originally from Illustrator. There are many linked objects. But if I unlink those objects all of them a shifted according their x and y coordinates. See attached pictures. I need the objects after unlinking stay on their positions. May you help me to solve this problem, please?

ink_xml.png
information about object in XML editor
ink_xml.png (15.25 KiB) Viewed 1853 times
ink_before_unlink.png
before unlink
ink_before_unlink.png (13.5 KiB) Viewed 1853 times
ink_after_unlink.png
after unlink, the shift is exactly as x and y coordinates
ink_after_unlink.png (10.96 KiB) Viewed 1853 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: cloned objects shifted after unlink clone

Postby brynn » Thu Apr 26, 2012 1:55 pm

Image
Welcome to InkscapeForum!

Hhmmm....well someone else can probably answer this more directly, but I can give you some clues. First, it should not be moving.

When I create some examples to experiment, I find the x and y attributes are both a value of 0, no matter where I place the clones. What that tells me is that A - I don't know what those x and y attributes mean, and B - that apparently they are not the coordinates of the object. I see that the originals, or clone parents don't even have x and y attributes. (That's using an ellipse and rectangular path to test.)

But when I use some text to test, I see that text has x and y attributes with a non-zero value. I'm not sure what that means. However, if I clone the text, the clone, no matter where I move it, has the 0 value for x and y.

However, in my XML Editor, my transform attribute has translate as a value, while your's has matrix. I honestly don't know what that means. But clearly you've performed some kind of transformation related to that clone and/or it's parent.

The bottom line, as far as the XML Editor is concerned, is that the x and y attributes are not the coordinates. Those can be seen in the Selection tool control bar, in the main window.

All that said, the clone should not be moving when you break it's link. This is smelling like a bug to me, but I'll have to do some searching in the bug tracker to find out for sure. It may be related to a well known bug with the transform attribute. I'll see what I can find in the bug tracker, but other members may be better suited, if it is a bug.

Meanwhile, maybe you could use Duplicate or Copy/Paste instead of cloning? What is your Inkscape version and operating system?

Edit
After some searching, I haven't found an existing report about this. It may be a previously unknown bug, or it may be related to an existing bug in some way that I don't understand. Would you be able to provide the SVG file for us to examine?

akuls
Posts: 4
Joined: Wed Apr 25, 2012 6:05 pm

Re: cloned objects shifted after unlink clone

Postby akuls » Thu Apr 26, 2012 5:17 pm

brynn wrote:Image
Welcome to InkscapeForum!


Thanks much

brynn wrote:Meanwhile, maybe you could use Duplicate or Copy/Paste instead of cloning? What is your Inkscape version and operating system?


It is not my file. It is file created in Illustrator with kind of "symbols library". Symbols were copy/pasted from it. Then saved as SVG and I opened it in Inkscape. I have to edit it and save as another format. Because of problem with shifting we started to check where could be the problem. I'll add the svg file for analyze. All objects which are not lines ("points" in sense of Illustrator) are clones of definition of such object in second part of svg file (after header).

BTW shift after unlinking is exactly as x,y coordinates in cloned object.

Martin
Attachments
test_2_shift_symbols.zip
test file for shifts of objects
(29.01 KiB) Downloaded 167 times

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: cloned objects shifted after unlink clone

Postby ~suv » Thu Apr 26, 2012 5:20 pm

akuls wrote:I have a problem with Inkscape clone behavior. I should edit svg file originally from Illustrator. There are many linked objects. But if I unlink those objects all of them a shifted according their x and y coordinates. See attached pictures. I need the objects after unlinking stay on their positions. May you help me to solve this problem, please?

Could you attach a sample SVG file please? And provide information about which Inkscape version you use (see Inkscape menu 'Help > About Inkscape')?

(There are several known issues with displaced clones - often related to 'transform' attributes on parent containers, or the originals, or both the clones and the originals - but I won't search for a related bug report without having been able to take a look at the structure of the SVG file and Inkscape's behavior myself - the screenshot only shows partial info and potentially misses the underlying trigger completely).

akuls
Posts: 4
Joined: Wed Apr 25, 2012 6:05 pm

Re: cloned objects shifted after unlink clone

Postby akuls » Thu Apr 26, 2012 5:25 pm

~suv wrote:Could you attach a sample SVG file please?

sended
~suv wrote:And provide information about which Inkscape version you use

MacOSX 10.5.8, Inkscape 0.48.1 r9760

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: cloned objects shifted after unlink clone

Postby ~suv » Sat Apr 28, 2012 11:15 pm

akuls wrote:I have a problem with Inkscape clone behavior. I should edit svg file originally from Illustrator. There are many linked objects. But if I unlink those objects all of them a shifted according their x and y coordinates.

The "clones" (instances of SVG <symbol> elements, not regular Inkscape clones) do not shift according to the x and y coordinates - they shift because Inkscape does not fully honor the offset defined in the 'viewBox' attribute of the <symbol> definition.

Note: Inkscape does not create <symbol> elements itself, and has only limited support for <symbol> elements with a 'viewBox' attribute (rendering is ok, but for example until recently export to PDF/EPS/PS was incorrect).

=> AFAICT what you are trying to do is not fully supported by current Inkscape versions: unlinking instances (aka svg <use> elements) of <symbol> elements the same way as can be done with Inkscape's regular "clones" (<use> elements referencing regular objects like for example groups):
The key distinctions between a ‘symbol’ and a ‘g’ are:
  • A ‘symbol’ element itself is not rendered. Only instances of a ‘symbol’ element (i.e., a reference to a ‘symbol’ by a ‘use’ element) are rendered.
  • A ‘symbol’ element has attributes ‘viewBox’ and ‘preserveAspectRatio’ which allow a ‘symbol’ to scale-to-fit within a rectangular viewport defined by the referencing ‘use’ element.
Closely related to the ‘symbol’ element are the ‘marker’ and ‘pattern’ elements.


Resources:
  • Subject: Re: Misplaced objects with librsvg or EPS:
    «It's not surprising, as your file uses <symbol> elements with viewbox
    attribute. We do not officially support them yet. As you see they
    render OK, but obviously they have bugs because they were not tested
    up to now. In your file they likely originate from Illustrator.»
  • Bug #705345 “Cairo rendering broken for "use" elements with scaling or a viewBox” got recently fixed (with Inkscape 0.48.2, symbols are correctly rendered in the exported PDF/PS/EPS files)
  • Likely related reports/questions: Bug #166257, Bug #568833, Question #147389
  • Off-topic: you sample file has two invalid SVG properties (negative height / width values) which causes it to not correctly render in other SVG viewers
ToDo:
  • Your file causes current builds of the development branch to crash: I need to file a separate report for this regression (the crash is triggered when opening files with '<symbol>' definitions outside a '<defs>' section - AFAICT this is valid SVG, and earlier versions of Inkscape before the merge of the rendering cache branch handled it ok)
  • Partial support of <symbol> elements seems to be known (boils down to limited support of 'viewBox' in general). I do want to search again in-depth whether we do have an explicit feature request filed to fully support <symbol> elements with a viewBox attribute (fully = not only render them as expected, but also allow other manipulations without disregarding the viewBox attribute in the symbol definition).

Off topic:
akuls wrote:MacOSX 10.5.8, Inkscape 0.48.1 r9760
If you are willing to upgrade X11 to a newer version of XQuartz (>= 2.5.1), you can also run Inkscape 0.48.2 on Leopard (Inkscape 0.48.2 won't work with Apple's older version of X11 (2.1.6)).

akuls
Posts: 4
Joined: Wed Apr 25, 2012 6:05 pm

Re: cloned objects shifted after unlink clone

Postby akuls » Mon Apr 30, 2012 7:06 pm

~suv wrote:Note: Inkscape does not create <symbol> elements itself, and has only limited support for <symbol> elements with a 'viewBox' attribute (rendering is ok, but for example until recently export to PDF/EPS/PS was incorrect).


Thank you for explanation. Great help for me.

m.


Return to “Help with using Inkscape”