mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-15 15:26:05 +00:00
25 lines
470 B
JavaScript
25 lines
470 B
JavaScript
|
|
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;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|