mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Handle exporting of empty paths.
This commit is contained in:
parent
9d8bf12028
commit
589d4e6e73
2 changed files with 9 additions and 3 deletions
|
@ -18,6 +18,8 @@
|
|||
var segments = [new Point(30, 90), new Point(100, 150)];
|
||||
var path2 = new Path(segments);
|
||||
path2.strokeColor = 'yellow';
|
||||
|
||||
var path3 = new Path();
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSvg());
|
||||
</script>
|
||||
|
|
|
@ -182,9 +182,11 @@ new function() {
|
|||
return segments.length === 4 && path._closed
|
||||
&& isColinear(0, 2) && isColinear(1, 3)
|
||||
? 'rect'
|
||||
: segments.length >= 3
|
||||
? path._closed ? 'polygon' : 'polyline'
|
||||
: 'line';
|
||||
: segments.length === 0
|
||||
? 'empty'
|
||||
: segments.length >= 3
|
||||
? path._closed ? 'polygon' : 'polyline'
|
||||
: 'line';
|
||||
} else if (path._closed) {
|
||||
if (segments.length === 8
|
||||
&& isArc(0) && isArc(2) && isArc(4) && isArc(6)
|
||||
|
@ -236,6 +238,8 @@ new function() {
|
|||
angle = determineAngle(path, segments, type, center),
|
||||
attrs;
|
||||
switch (type) {
|
||||
case 'empty':
|
||||
return null;
|
||||
case 'path':
|
||||
attrs = {
|
||||
d: getPath(path, segments)
|
||||
|
|
Loading…
Reference in a new issue