svg.nas fix transformation problems and use setClipByBoundingBox() from API
This commit is contained in:
parent
c234f22daa
commit
fb73705281
1 changed files with 9 additions and 23 deletions
|
@ -92,28 +92,14 @@ var parsesvg = func(group, path, options = nil)
|
||||||
|
|
||||||
if( cur_clip != nil )
|
if( cur_clip != nil )
|
||||||
{
|
{
|
||||||
if( cur_clip['x'] != nil
|
if(cur_clip['x'] != nil and cur_clip['y'] != nil
|
||||||
and cur_clip['y'] != nil
|
and cur_clip['width'] != nil and cur_clip['height'] != nil ) {
|
||||||
and cur_clip['width'] != nil
|
stack[-1].setClipByBoundingBox(cur_clip['x'], cur_clip['y'],
|
||||||
and cur_clip['height'] != nil )
|
cur_clip['x'] + cur_clip['width'], cur_clip['y'] + cur_clip['height']);
|
||||||
{
|
}
|
||||||
var rect = sprintf(
|
else {
|
||||||
"rect(%f, %f, %f, %f)",
|
printlog("warn", "Invalid or unsupported clip for element '" ~ id ~ "'");
|
||||||
cur_clip['y'],
|
|
||||||
cur_clip['x'] + cur_clip['width'],
|
|
||||||
cur_clip['y'] + cur_clip['height'],
|
|
||||||
cur_clip['x']
|
|
||||||
);
|
|
||||||
|
|
||||||
stack[-1].set("clip", rect);
|
|
||||||
stack[-1].set("clip-frame", canvas.Element.LOCAL);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
printlog(
|
|
||||||
"warn",
|
|
||||||
"Invalid or unsupported clip for element '" ~ id ~ "'"
|
|
||||||
);
|
|
||||||
|
|
||||||
cur_clip = nil;
|
cur_clip = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,7 +605,7 @@ var parsesvg = func(group, path, options = nil)
|
||||||
pushElement("image", attr["id"]);
|
pushElement("image", attr["id"]);
|
||||||
|
|
||||||
if (attr["x"] != nil and attr["y"] != nil) {
|
if (attr["x"] != nil and attr["y"] != nil) {
|
||||||
stack[-1].setTranslation(attr["x"], attr["y"]);
|
stack[-1].createTransform().setTranslation(attr["x"], attr["y"]);
|
||||||
}
|
}
|
||||||
if (attr["width"] != nil and attr["height"] != nil) {
|
if (attr["width"] != nil and attr["height"] != nil) {
|
||||||
stack[-1].setSize(attr["width"], attr["height"]);
|
stack[-1].setSize(attr["width"], attr["height"]);
|
||||||
|
@ -728,7 +714,7 @@ var parsesvg = func(group, path, options = nil)
|
||||||
stack[-1].setText(tspan.text);
|
stack[-1].setText(tspan.text);
|
||||||
|
|
||||||
if( x != 0 or y != 0 )
|
if( x != 0 or y != 0 )
|
||||||
stack[-1].setTranslation(x, y);
|
stack[-1].createTransform().setTranslation(x, y);
|
||||||
|
|
||||||
if( size(tspans) == 1 )
|
if( size(tspans) == 1 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue