Skip to content

Commit b9880a2

Browse files
authored
fix: SVG importer keep two vertices on closing (Z) a SVG path (synfig#3558)
Issue: double spline port import svg fix synfig#3553
1 parent 29dcc9c commit b9880a2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

synfig-core/src/modules/mod_svg/svg_parser.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,19 @@ Svg_parser::parser_path_d(const String& path_d, const SVGMatrix& mtx)
14221422
break;
14231423
}
14241424
case 'z':{
1425+
if (k1.size() > 1) {
1426+
Vertex& first = k1.front();
1427+
const Vertex& last = k1.back();
1428+
if (approximate_equal(first.x, last.x) && approximate_equal(first.y, last.y)) {
1429+
// Merge!
1430+
first.angle1 = last.angle1;
1431+
first.radius1 = last.radius1;
1432+
first.split_angle = approximate_not_equal(first.angle1, first.angle2);
1433+
first.split_radius = approximate_not_equal(first.radius1, first.radius2);
1434+
1435+
k1.pop_back();
1436+
}
1437+
}
14251438
k.push_front(BLine(k1, true));
14261439
k1.clear();
14271440
current_x=init_x;

0 commit comments

Comments
 (0)