easyeda 0.0.379 → 0.0.381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -1078,7 +1078,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
1078
1078
  var package_default = {
1079
1079
  name: "easyeda",
1080
1080
  type: "module",
1081
- version: "0.0.378",
1081
+ version: "0.0.380",
1082
1082
  files: [
1083
1083
  "dist"
1084
1084
  ],
@@ -15585,22 +15585,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
15585
15585
  const centerY = midY - h * Math.cos(angle) * centerDirection;
15586
15586
  const startAngle = Math.atan2(startY - centerY, startX - centerX);
15587
15587
  let endAngle = Math.atan2(endY - centerY, endX - centerX);
15588
- if (sweepFlag && endAngle > startAngle) {
15589
- endAngle -= 2 * Math.PI;
15590
- } else if (!sweepFlag && endAngle < startAngle) {
15588
+ if (sweepFlag && endAngle < startAngle) {
15591
15589
  endAngle += 2 * Math.PI;
15590
+ } else if (!sweepFlag && endAngle > startAngle) {
15591
+ endAngle -= 2 * Math.PI;
15592
15592
  }
15593
- if (!largeArcFlag && Math.abs(endAngle - startAngle) > Math.PI || largeArcFlag && Math.abs(endAngle - startAngle) < Math.PI) {
15594
- if (endAngle > startAngle) {
15595
- endAngle -= 2 * Math.PI;
15596
- } else {
15597
- endAngle += 2 * Math.PI;
15598
- }
15599
- }
15600
- const numPoints = Math.max(
15601
- 2,
15602
- Math.ceil(Math.abs(endAngle - startAngle) * radius)
15603
- );
15593
+ const arcAngle = Math.abs(endAngle - startAngle);
15594
+ const minNumPoints = Math.max(2, Math.ceil(arcAngle * radius));
15595
+ const isSemicircle = Math.abs(arcAngle - Math.PI) < 1e-6;
15596
+ const numPoints = isSemicircle ? minNumPoints + minNumPoints % 2 : minNumPoints;
15604
15597
  const path = [];
15605
15598
  for (let i = 0; i <= numPoints; i++) {
15606
15599
  const t = i / numPoints;
@@ -18356,9 +18349,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
18356
18349
  elementStrings.push(
18357
18350
  `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" diameter="${mmStr(hole.hole_diameter)}" />`
18358
18351
  );
18359
- } else if (hole.hole_shape === "oval") {
18352
+ } else if (hole.hole_shape === "oval" || hole.hole_shape === "rect" || hole.hole_shape === "pill" || hole.hole_shape === "rotated_pill") {
18353
+ const shape = hole.hole_shape === "rotated_pill" ? "pill" : hole.hole_shape;
18354
+ const rotationAttr = hole.hole_shape === "rotated_pill" ? getRotationAttr(hole.ccw_rotation) : "";
18360
18355
  elementStrings.push(
18361
- `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" width="${mmStr(hole.hole_width)}" height="${mmStr(hole.hole_height)}" shape="oval" />`
18356
+ `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" width="${mmStr(hole.hole_width)}" height="${mmStr(hole.hole_height)}" shape="${shape}"${rotationAttr} />`
18362
18357
  );
18363
18358
  }
18364
18359
  }