On 2014-09-05 22:03 , su_v wrote:
On 2014-09-05 19:29 , mathog wrote:
One of the changes I introduced at revision 13544 was a modification of
scaleChildItemsRec()
so that it no longer recurses into groups to apply scaling changes associated with a change of units. This was breaking EMF import of clipped objects. That happened because during the recursion the coordinates of the clipped objects were changed directly, not by a transform. Since the clipping object (in defs) was not similarly scaled this broke the clip. See for instance:
https://bugs.launchpad.net/inkscape/+bug/1348417
In the changed version the scaling change is applied as a transform at the group level, and all the coordinates within that group are not directly modified, so the clipping object and clipped objects are still at the same scale and they continue to work together. Since EMF import of clipped objects always works like (pseudocode):
<g (clip reference)> clipped objects
</g>
applying the transform at the group level fixes the problem in that context.
I suspect that scaleChildItemsRec() is still going to cause problems for any SVG object other than a group that looks something like (pseudocode):
<(not a group) (a clip or mask ref) x=100 y=100 (other stuff)
when the document units are changed because it will change the 100's to something else, and not modify the referenced clipping object. I have not confirmed this though.
In any case, would the people who worked on document units please see if my changes at revision 13544 break anything when the document units are changed? I did some preliminary testing and it looked OK, but I don't really know what test cases to use to explore all the edge cases.
The changes in rev 13544 seem to also fix the issue tracked in
- Bug #1287288 "trunk: clip-path of clipped group incorrectly scaled when changing default units (rev >= 12554)" https://bugs.launchpad.net/inkscape/+bug/1287288
at least based on the two test cases attached there (one with clipped groups, one with masked groups). I plan to close the report once we have one more confirmation (maybe with real-life test case).
New regression with r13544:
Steps to reproduce: 1) launch inkscape (default (new) prefs, default template (locale: en_US)) 2) draw a rect 100px x 100px (size in rect tool controls bar) 3) deselect the rectangle (<esc>) 4) open Document properties and change default units to 'mm' 5) draw a rectangle 100mm x 100mm (size in rect tool controls bar)
Expected result: The two rectangles differ in size on canvas.
Actual result: - The two rectangles have the same size on-canvas - Select tool and rectangle tool are out of sync wrt size and units
The underlying issue seems that now (after r13544) changing document units applies a preserved 'scale()' transformation to all top-level layer groups, which did not happen with earlier revisions.
Regards, V