Commit 02f56d06 authored by frohlfs's avatar frohlfs
Browse files

Nested svg areas are misplaced or invisible

If the root svg uses transformations ( e.g. defines a viewBox and
different width and height) the nested svg areas are misplaced or
invisible.
parent 2bf55043
......@@ -131,7 +131,7 @@ namespace Svg
if (this.Equals(SvgViewBox.Empty))
{
renderer.TranslateTransform(x, y);
renderer.TranslateTransform(x, y, MatrixOrder.Prepend);
return;
}
......@@ -199,11 +199,11 @@ namespace Svg
break;
}
}
renderer.SetClip(new Region(new RectangleF(x, y, width, height)), CombineMode.Intersect);
renderer.ScaleTransform(fScaleX, fScaleY, MatrixOrder.Prepend);
renderer.TranslateTransform(x, y);
renderer.TranslateTransform(fMinX, fMinY);
renderer.TranslateTransform(x, y, MatrixOrder.Prepend);
renderer.TranslateTransform(fMinX, fMinY, MatrixOrder.Prepend);
renderer.ScaleTransform(fScaleX, fScaleY, MatrixOrder.Prepend);
}
}
......
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg x="0" y="0" width="450" height="551" viewBox="0 0 670 820" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="0" y="0" width="670" height="820" style="fill:black" />
<rect x="100" y="200" width="50" height="100" style="fill:blue" />
<svg x="100" y="200" width="50" height="100" viewBox="0 0 75 150">
<line x1="0" y1="0" x2="75" y2="0" style="stroke:white;" />
<line x1="75" y1="0" x2="75" y2="150" style="stroke:white;" />
<line x1="75" y1="150" x2="0" y2="150" style="stroke:white;" />
<line x1="0" y1="150" x2="0" y2="0" style="stroke:white;" />
</svg>
<rect x="200" y="200" width="50" height="25" style="fill:blue" />
<svg x="200" y="200" width="50" height="100" viewBox="0 0 100 50" preserveAspectRatio="xMaxYMin meet">
<line x1="0" y1="0" x2="100" y2="0" style="stroke:white;" />
<line x1="100" y1="0" x2="100" y2="50" style="stroke:white;" />
<line x1="100" y1="50" x2="0" y2="50" style="stroke:white;" />
<line x1="0" y1="50" x2="0" y2="0" style="stroke:white;" />
</svg>
<rect x="300" y="275" width="50" height="25" style="fill:blue" />
<svg x="300" y="200" width="50" height="100" viewBox="0 0 100 50" preserveAspectRatio="xMaxYMax meet">
<line x1="0" y1="0" x2="100" y2="0" style="stroke:white;" />
<line x1="100" y1="0" x2="100" y2="50" style="stroke:white;" />
<line x1="100" y1="50" x2="0" y2="50" style="stroke:white;" />
<line x1="0" y1="50" x2="0" y2="0" style="stroke:white;" />
</svg>
</svg>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment