refactor: plotter code
This commit is contained in:
parent
a4e8e31921
commit
7be206581d
|
|
@ -29,6 +29,7 @@ export function pts2plotter(
|
||||||
if (sorted.length > 0) {
|
if (sorted.length > 0) {
|
||||||
const firstPath = sorted[0];
|
const firstPath = sorted[0];
|
||||||
str += ` U${plu(start[0] * px2mm)},${plu((height - start[1]) * px2mm)}`;
|
str += ` U${plu(start[0] * px2mm)},${plu((height - start[1]) * px2mm)}`;
|
||||||
|
str += ` U${plu(firstPath[0][0] * px2mm)},${plu((height - firstPath[0][1]) * px2mm)}`;
|
||||||
str += ` D${plu(firstPath[0][0] * px2mm)},${plu((height - firstPath[0][1]) * px2mm)}`;
|
str += ` D${plu(firstPath[0][0] * px2mm)},${plu((height - firstPath[0][1]) * px2mm)}`;
|
||||||
|
|
||||||
// 切割第一个路径
|
// 切割第一个路径
|
||||||
|
|
@ -66,6 +67,8 @@ export function pts2plotter(
|
||||||
|
|
||||||
// 返回终点
|
// 返回终点
|
||||||
str += ` U${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`;
|
str += ` U${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`;
|
||||||
|
str += ` D${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`;
|
||||||
|
str += ` U${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`;
|
||||||
str += endCommand();
|
str += endCommand();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue