You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
470 B
25 lines
470 B
1 year ago
|
import noop from "../noop";
|
||
|
|
||
|
export default function() {
|
||
|
var lines = [],
|
||
|
line;
|
||
|
return {
|
||
|
point: function(x, y) {
|
||
|
line.push([x, y]);
|
||
|
},
|
||
|
lineStart: function() {
|
||
|
lines.push(line = []);
|
||
|
},
|
||
|
lineEnd: noop,
|
||
|
rejoin: function() {
|
||
|
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
|
||
|
},
|
||
|
result: function() {
|
||
|
var result = lines;
|
||
|
lines = [];
|
||
|
line = null;
|
||
|
return result;
|
||
|
}
|
||
|
};
|
||
|
}
|