translations of groups are not converted to new units when changing document units
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Wishlist
|
Alvin Penner |
Bug Description
This is not exactly a bug report, more of a wish list item, but it does have some significant programming implications. When converting document units one would expect that not only would the coordinates of child objects like <path> elements be converted into the new units, but also that any translations on the parent groups would also be converted at the same time. Not that there is any mathematical reason for doing so, but simply for the sake of ease of interpretation.
Attached is a svg file (file line100_px.svg) with a path with a parent group with a translation. The relevant part is:
<g
transform=
<path
d="M 100,100 200,200"
/>
</g>
Since both the group and the object start point have coordinates of (100, 100) px, therefore the top left start point is at (200, 200) px.
After converting to mm one would therefore expect the following:
<g
transform=
<path
d="M 28.22,28.22 56.44,56.44"
/>
</g>
Related branches
tags: | added: groups transformations units |
Changed in inkscape: | |
importance: | Undecided → Wishlist |
milestone: | none → 0.91 |
Changed in inkscape: | |
status: | New → Confirmed |
Changed in inkscape: | |
importance: | Wishlist → Medium |
milestone: | 0.91 → 0.92 |
Changed in inkscape: | |
milestone: | none → 0.92 |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
Instead one gets (file line100_mm.svg) with the excerpt:
<g "translate( 100,100) "> -43.555554 28.222223, 28.222223"
transform=
<path
d="m -43.555547,
/>
</g>
Note that the final result is correct, so there is nothing mathematically wrong with this result. The final coordinates of the start point of the line are 100mm - 43.5555mm = 56.4444mm, which is equivalent to 200px as expected.
However the intermediate results are unexpected. The group translation is now 100mm when we expected 28.22mm. The actual numerical coordinates of the start (x,y) in the <path> element are negative (-43.555) instead of positive, which makes it very difficult to interpret.
This will also complicate things when trying to solve problems like Bug 1287288. This involves groups which may have translations in the <group> element, and which also have clips or masks attached to them. The clip or mask is applied relative to the object before the translations are applied. This means that if the translate property of the group is not converted as expected then the origin of the clip will also be correspondingly wrong, which represents a serious complication in the case of multiple nested groups.