refactor: plotter code

This commit is contained in:
hyper 2026-03-15 21:08:41 +08:00
parent a4e8e31921
commit 7be206581d
1 changed files with 3 additions and 0 deletions

View File

@ -29,6 +29,7 @@ export function pts2plotter(
if (sorted.length > 0) {
const firstPath = sorted[0];
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)}`;
// 切割第一个路径
@ -66,6 +67,8 @@ export function pts2plotter(
// 返回终点
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();
return str;