CIF type checker: add warnings for SVG transforms that don't do what you expect that they do
Proposed changes:
-
Consider that you have an SVG element with a transform=translate(...)
on it, set via an SVG output mapping. If you now move the element, then Inkscape (other tools maybe as well) will add atransform
of itself to the moved element. The SVG output mapping then overrides the transform. Especially new users will be surprised by this. The element may suddenly be outside the canvas then, or in the wrong place. We could introduce type checker warnings for overwriting atransform
. (!1114 (merged)) -
Slightly trickier is when an ancestor of the element on which you're setting a transform
, has atransform
. If you do atranslate
and the ancestor as well, they add up, and you likely get the expected result. If any ancestor does arotate
,scale
,matrix
or so, you'd likely get unexpected results. We could also introduce type checker warnings for this. -
In the CIF documentation, explain what can go wrong, as well as different ways to solve it (ungroup/regroup trick, multiple wrapper groups, etc). -
Refer in the warning messages to the CIF documentation.
Alternative could be:
- Add a special kind of SVG output mapping for transforms that is additive, rather than overwriting the transform. This would not indicate problems, but solve them. It is rather specific for transforms though.
- Do the ungroup/regroup trick (which pushes transforms inwards to child elements) in the CIF simulator, CIF code generator for HTML, etc. It would also solve the problem. It is rather hidden, and the semantics of SVG output mappings would differ (being overwrite/additive) for different attributes, which may be confusing.
But, we do not opt for these.
Edited by Ferdie Reijnen