mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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
|
@ -19,6 +19,8 @@
|
||||||
var path2 = new Path(segments);
|
var path2 = new Path(segments);
|
||||||
path2.strokeColor = 'yellow';
|
path2.strokeColor = 'yellow';
|
||||||
|
|
||||||
|
var path3 = new Path();
|
||||||
|
|
||||||
document.getElementById('svg').appendChild(project.exportSvg());
|
document.getElementById('svg').appendChild(project.exportSvg());
|
||||||
</script>
|
</script>
|
||||||
<svg id="svg" style="width: 500px; height: 500px"></svg>
|
<svg id="svg" style="width: 500px; height: 500px"></svg>
|
||||||
|
|
|
@ -182,6 +182,8 @@ new function() {
|
||||||
return segments.length === 4 && path._closed
|
return segments.length === 4 && path._closed
|
||||||
&& isColinear(0, 2) && isColinear(1, 3)
|
&& isColinear(0, 2) && isColinear(1, 3)
|
||||||
? 'rect'
|
? 'rect'
|
||||||
|
: segments.length === 0
|
||||||
|
? 'empty'
|
||||||
: segments.length >= 3
|
: segments.length >= 3
|
||||||
? path._closed ? 'polygon' : 'polyline'
|
? path._closed ? 'polygon' : 'polyline'
|
||||||
: 'line';
|
: 'line';
|
||||||
|
@ -236,6 +238,8 @@ new function() {
|
||||||
angle = determineAngle(path, segments, type, center),
|
angle = determineAngle(path, segments, type, center),
|
||||||
attrs;
|
attrs;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case 'empty':
|
||||||
|
return null;
|
||||||
case 'path':
|
case 'path':
|
||||||
attrs = {
|
attrs = {
|
||||||
d: getPath(path, segments)
|
d: getPath(path, segments)
|
||||||
|
|
Loading…
Reference in a new issue